Friday, 1 November 2013

How to rebuild or recover a corrupt RPM database.

Sometimes you may end up in a situation such as your rpm databases are corrupt. Don't get worried, we have an option to rebuild/recover the corrupt rpm databases.

You can follow the steps below but I am not giving any assurance that, this will solve all your problem on rpms.

First of  take a backup of rpm database directory. As we all know rpm database is located in  "/var/lib/", named as a directory "rpm".

Navigate to the location and tar the directory.

cd /var/lib/
tar -cvzf rpmdb.tar.gz rpm.

Now, lets remove rpm locks if present:
cd /var/lib/rpm

rm -rf  __db*

After that try rebuild:

rpm --rebuilddb -vv

Once the above command is executed, you should be able to do an yum update.

 yum update

Thats it :)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.