Today I received an email from my server cron running on Apache CentOS 6.1:
Cron <root@server> /usr/bin/yum -y -R 120 -d 0 -e 0 update
rpmdb: Thread/process 4936/139915147442080 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
Error: rpmdb open failed
Basically you need to move your rpm db files to a tmp folder, then rebuild the database.
Update: February 26, 2020
If you use cPanel and have full administrator access to WHM you can rebuild the RPM database as well. Please see second option below.
Option 1. Fix the Yum Database Update Error with SSH
First, don’t panic. Log into your console and move the db files to your temp folder:
mv /var/lib/rpm/__db* /tmp
Run a rebuild
Clean up the leftovers
yum clean all
After this you should be back in business. The two tutorials I found do things in a different order. I tried the order above and it worked fine. The article on svenned.be says to “clean” then run “yum update”, while ma.ttias.be says to just rebuild and clean. I’m not sure the difference really, but the first option seemed to work for me. I ran a yum update afterwards and it said there was nothing to update, but the databases were back in place.
Option 2. Fix Corrupt RPM Database through cPanel’s WHM Interface
- Log into WHM like usual
- Scroll down to the software section and click on “rebuild rpm database” or use the quick search
- Click rebuild and wait until it’s finished
This method has worked for me on multiple occasions. Hope this option helps those with cPanel!