Technology Weblog

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


No Responses to “Repair Corrupt RPM databases”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: