Debian – reinstalling full system on debian

debian

EXT2 boot drive got corrupted on a small debian box I'm running, nothing critical. An fsck took care of the fs level damage. The machine boots now, but there's apparently lots of little lib files and other stuff that got messed up when the drive messed up.

Now, I can certainly restore from backup (yes, I have one), but I was wondering if debian will set up to do something like

# apt-get install –reinstall [everything]

Off the top of my head, I can bash something like (idea code, not good code, I know)

# dpkg -l | awk [whatever] | apt-get install –reinstall {}

but if apt-get already has that option somewhere, why reinvent the wheel? Although googling doesn't bring up anything obvious.

The other question is whether doing a reinstall everything may actually be a bad idea for some reason?

Thoughts?

Best Answer

Not with apt-get but:

aptitude reinstall '~i'

means "reinstall all installed packages".

However this will NOT replace missing or altered conffiles or other configuration files if they are missing, since debian assumes that if a configuration file is missing or altered, it is for a good reason. There are various ways to get back configuration files, but it unfortunately depends on how the package missing configuration files is setup. If there is a possibility that configuration files are missing or corrupt, you should probably just reinstall from install media.