Fedora : Repair Corrupt RPM databases

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

You may also like...