RHEL/CentOS/Fedora Fix-all packages
I used this to get out of a real tough situation. My home server was crashing due to a hardware problem and of coarse it crash during updates. At first this happened every once in a while and yum-complete-transaction would bring it back. But one day it crashed hard. I had to boot into my CentOS’s recovery mode to run the first few commands.
yum-complete-transaction --cleanup-only package-cleanup --cleandupes #TODO dump duplicates to dups.log cat dups.log | cut -f 6 -d " " | while read in; do rpm -e --justdb $in; done yum reinstall $(cat dups.log | cut -f 1 -d " " | tr '\n' ' ') --skip-broken yum verify-all > yum-verify.log cat yum-verify.log | grep "^[a-zA-Z0-9]" | cut -f 1 -d " " | grep -v "Loaded" | uniq > naughty.log yum reinstall $(cat naughty.log | tr '\n' ' ') --skip-broken
If you run all these commands, you’ll end up with a yum-verify.log file and a naughty.log file. The yum-verify file is just the output of ‘yum verify-all;’ you can refer to it if you need to know why a package was selected for reinstall. The naughty.log file contains a list of packages listed in the verify-all file. You can see in this file all of the packages that are installed in the last line. You can add or remove lines if you want to change what is reinstalled in the last line.