Pages

Unixbhaskar's Blog

Saturday, March 20, 2010

How to recover from corrupt rpm database on RHEL/CentOS/Fedora

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.

I do not issue any guarantee that this will work for you.

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:

cd /var/lib/rpm

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 update

yum install anypackage

rpm -qi packagename


Don't forget to check the system log file in case it spitting out other msg.

This is a good pointer for recover.

Hope this will help.

Bhaskar Chowdhury

No comments:

Post a Comment