Rebuild Corrupted Yum Database

If you server crashes during a yum operation, your yum metadata can get corrupted causing issues, and you have to rebuild it.

Rebuilding rpmdb

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

yum clean all
yum update 

Errors you might see

rpmdb: Thread/process 7940/140325995558656 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed 
(Comments)

Comments