Yum Error: Thread died in Berkeley DB library | rpmdb open failed

Issue

When executing Yum you receive the following error,

[root@william-gce blog]# yum install npm
rpmdb: Thread/process 3934/139752225695488 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

Solution

This can be caused by a corrupted rpm db. To fix delete the __db* files and then run rpm –rebuilddb. Heres an example,

[root@william-gce blog]# rm -f /var/lib/rpm/__* [root@william-gce blog]# rpm --rebuilddb

You will now be able to execute Yum.

[root@william-gce blog]# yum install npm
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: centos.vwtonline.net
* epel: mirror.symnds.com
* extras: mirror.5ninesolutions.com
* updates: linux.cc.lehigh.edu
* webtatic: us-east.repo.webtatic.com
Rick Donato

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial