Repair the RPM database

I had a problem with running a yum update on some package. The process
would sleep indefinitely. A clue that something was wrong with the RPM
database (at /var/lib/rpm) was that running rpm -qa would hang as

The solution is to rebuild the RPM database. In short:

#Ā Backups!  
tarĀ -czvfĀ /tmp/rpm.tgzĀ /var/lib/rpm  
#Ā RemoveĀ theĀ databaseĀ locks  
rmĀ -fĀ /var/lib/rpm/__db*  
#Ā Rebuild!  
rpmĀ -vvĀ --rebuilddb

That should do it.