How to recover RPMDB in RHEL / CentOS / Fedora
You can see below is the error while updating RHEL/CentOS/Fedora using yum update
[root@babar rpm]# yum update
rpmdb: Thread/process 8367/457660786 failed: Thread died in Berkeley DB library
error: db4 error(-41638) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 – (-30575)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:Error: rpmdb open failed
New Please check RPMDB file and rebuild if corrupted using below commands
[root@babar ~]# cd /var/lib/rpm/
[root@babar rpm]# ls
Basenames __db.001 __db.003 Dirnames Group Name Packages Provideversion Requirename Sha1header Triggername
Conflictname __db.002 __db.004 Filedigests Installtid Obsoletename Providename Pubkeys Requireversion Sigmd5
Then run below command to remove the old db file and rebuild new db
[root@babar rpm]# rm -rf /var/lib/rpm/__db.00*
[root@babar rpm]# rpm –rebuilddb
Now you can run yum update command to check rpmdb is recovered
[root@babar rpm]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: nl.mirror.eurid.eu
* extras: ftp.nluug.nl
* updates: mirror.nl.leaseweb.net
Setting up Update Process
No Packages marked for Update
You have new mail in /var/spool/mail/root
[root@babar rpm]#