Is there a safe way to reinstall via the package manager?

Assume, I have a system with all the packages installed, which I want, and all configuration files set up as desired. However, the files on the file system could have become corrupted or missing due to some mistake in the past or hardware error. The corrupted files would be replace if the package in question was reinstalled. Such a situation is described elsewhere

Can I safely run

aptitude reinstall ?installed

to get a fresh version of my system?


A good way to deal with file corruption is to use `debsums' (see these instructions, and also this great answer), though they're starting with a non-booting system) which will discover which files are corrupted; then you can reinstall just those packages.

Your reinstall command is safe, but it's not guaranteed to fix everything that might have been caused by a hardware error.

You might also like to force a fsck or run a badblocks scan. You can do both of those from inside the disk utility.