Solution for error: cannot open Packages database in /var/lib/rpm

In this guide, a simple and single remove command will help us to recover from the corrupted yum database. While we try to clean packages using “yum clean all” if we face error remove the DB and run “yum repolist” which will again rebuild the database.

[root@ProSrv0765 ~]# yum clean all
rpmdb: Thread/process 57569/140362829735680 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:

# rm -rfv /var/lib/rpm/__*

Hope this will save your time.