Yum Error - Thread died in Berkeley DB library ... Error: rpmdb open failed)


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

Error: rpmdb open failed


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:
* epel:
* extras:
* updates:
* webtatic:

Tags: Yum, Linux