Fedora : Repair Corrupt RPM databases

by Carlos Dagorret on October 21, 2009

Sometimes RPM databases become corrupt. You will no longer be able to install/upgrade/remove programs using YUM or RPM command. Even RPM quey simply gets hung. This is the case when you need to repair RPM databases. You can use the simple script to do it.

cp -pr /var/lib/rpm{,`data +%F`.bk}
rm -f /var/lib/rpm/__db*
rpm -vv –rebuilddb

The first step is take a backup of  ‘ /var/lib/rpm‘ directory. Second clear the RPM database. Last rebuild database in in verbose mode so that you see the process taking place. Now your RPM database is perfect.

You can just check following command to confirm this.

rpm -qa

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
blog comments powered by Disqus

Previous post:

Next post: