Rebuilding the yum RPM database

Yum uses an internal database to keep track of the packages that are installed. On rare occasions, this database can get corrupted – usually when a yum update crashes halfway through. There’s a way to rebuild the database, of course.

First, remove the “old” database files. This moves them to /tmp, so you can always recover them again later.

$ mv /var/lib/rpm/__* /tmp/

Then rebuild the database.

$ rpm --rebuilddb
$ rpmdb_verify Packages

That should fix the yum database.