Fix Corrupt RPM DB

Fix Corrupt RPM DB

You might run into the error messages similar to this while running rpm or yum commands on RHEL or CentOS boxes.

rpmdb: Thread/process 4756/13433473157236 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

Both the rpm or yum commands would provide results similar to the one above.

The likely cause here is a corrupt RPM database.

There is a simple fix for this one.

Fix Corrupt RPM DB

RPM stores all it’s DB (Berkeley DB) under /var/lib/rpm. If you get the listing under that directory. Mine looks something like below:

[[email protected] ~]# ls /var/lib/rpm
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

Notice the __db.* files. Those happen to be the DB files for RPM.

You simply need to remove the __db.* files and rebuild the RPM database.

[[email protected] ~]# rm -rf /var/lib/rpm/__db.*

Now rebuild the RPM database.

[[email protected] ~]# rpm —rebuilddb

You should now be able to run the rpm or yum commands successfully.

Fix Corrupt RPM DB

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.