Fix Yum Database problems

By | April 10, 2014

If you are having yum update or yum install problems and getting errors like this:

rpmdb: Thread/process 17818/140028542469888 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:

Then you probably have a correct rpm or yum database.  Here is the fix for this:

rm -f /var/lib/yum/transaction-*
rm -Rf /var/lib/yum/rpmdb-indexes/
rm -f /var/lib/rpm/__*
db_verify /var/lib/rpm/Packages
rpm -vv --rebuilddb
yum clean all

This will blow away everything that is causing the corruption and get you up and running again!