How to recover from corrupt rpm database on RHEL/CentOS/Fedora
March 20, 2010 4 Comments
In this article I am going to show you a trick to recover from a corrupt rpm database…which might make the system defunct.As a direct result of that you just cannot install/upgrade/update the software in rpm base system like RHEL,CentOS and Fedora.
First and foremost thing take a backup of the existing rpm database( yes the corrupted one…you never know…).This is located in /var/lib/rpm ..depend on your distribution.
Now go to that dir(/var/lib) and take a backup of entire rpm dir ..like this:
tar -cvzf rpm-date.tar.gz rpm
And finally start rebuilding the rpm database like this:
rm -f __db* # delete it if present
rpm –rebuilddb -vv
Now once the above command finished work..other related thing should start working i.e
yum install anypackage
rpm -qi packagename
Don’t forget to check the system log file in case it spitting put other msg.
Hope this will help.