Rebuilding the yum RPM database

Profile image of Mattias Geniar

Mattias Geniar, November 28, 2014

Follow me on Twitter as @mattiasgeniar

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.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.