Take the 2-minute tour ×

After a power outage, my CentOS server began having a problem where many of the system commands became corrupted. As a result I have been getting messages saying "cannot execute binary file" on critical commands such as rm or mv. Using the linux rescue cd I managed to replace a few of the files to get me back to a mostly working state, but I am still running into issues with lesser-critical commands such as sed or tar. Rather than find and replace each file that may be broken individually, I would like to just go ahead and completely replace or repair these system commands to their default state. I have tried running the upgrade process from my CentOS disc, but this only caused a problem with my initrd file and did not correct any issue with my system commands. Can anyone suggest where I can find a package to reinstall these files without having to reinstall CentOS?

share|improve this question
I am not such a redhat guy, but couldnt rpm --verify help you? I mean something like rpm --verify `rpm -qa` –  Ency Mar 12 '11 at 19:54
I would be very tempted to just rebuild and restore. Without a full backup to compare against you may never be able to fix everything. –  Zoredache Mar 12 '11 at 21:51
add comment

1 Answer

up vote 3 down vote accepted

As @Ency suggests:

rpm --verify --all

will show you everything that's changed.

However, I suggest installing "yum-verify" or if it's not already installed and then using something like:

yum verify --verify-filenames='*bin/*'

This is very similar to the "rpm --verify", but you can restrict it to certain directories and it defaults to not showing you configuration file changes.

The output doesn't really tell you what package something is from, so you'd need to use:

rpm -qf /full/path/to/file


yum provides /full/path/to/file

to see what package that file belongs to

Then you could use:

yum reinstall packagename

to reinstall the RPM even if it's the same version.

However, I recommend backing up the files you need (/home, /etc, `/var/, etc.) and reinstalling everything from scratch. From what you described I suspect you won't find all the problems hiding on the system.

share|improve this answer
+1 But if the files became corrupt after a power failure it seems to indicate file system corruption. If reinstalling isn't an option it's probably a good idea to run fsck on the server's disk(s) before replacing the corrupt files. –  Registered User Mar 12 '11 at 21:51
add comment

Your Answer


