Sharing Knowledge | System Admin Articles

Repair corrupt RPM Database

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. To repair do the following:

cp -rp /var/lib/rpm{,`data +%F`.bk}

This command is to take a backup of  ' /var/lib/rpm' directory

rm -f /var/lib/rpm/__db*

This command clears the RPM database. Then enter the following command,

rpm -vv –rebuilddb

This command rebuild database in in verbose mode so that you see the process. Now your RPM database is perfect.
You can just check following command to confirm this.

rpm -qa

Hope this helps :)

Labels: Linux, Quick HOWTO

My Profile PhotoAbout the Author

I'm Parthiban, An UNIX System Admin by Profession. I'm Experienced in Linux/Unix System Administration and Scripting. I have done lot of work on the infrastructure Mgmt side in Linux, UNIX and Windows system administration, Hardware, Storage and Data center. I'm blogging since 2008.
Follow Me On Twitter or On Facebook

0 Comments for "Repair corrupt RPM Database"

What do you think about this Article? Add your Opinion..!

Back To Top