Rebuilding the yum RPM database

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

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.