RPM database error

If you get the error below you will need to rebuild your rpm database:
"error: cannot open Packages database in /var/lib/rpm"

To fix, run this use these commands

To remove any lock files (redhat only?)

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

Rebuild the database

rpm -vv --rebuilddb

(Note: we have added the option -vv here, so that there is visible progress and lots of detail during the rebuild process. A worried admin is often impatient at a lack of visible progress, this option causes the rebuild process to be quite verbose.)

Last updated: 22/02/2005