Red Hat – Berkeley DB library – Corrupted DB

Arunkumar NKL asked:

I am getting the below errors while executing the yum or rpm command.

error: rpmdb: BDB0113 Thread/process 22448/139817567954752 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 – (-30973)
error: cannot open Packages database in /var/lib/rpm
Error: rpmdb open failed

I believe this was happening because of corrupted RPM DB. I have tried to execute yum or rpm commands after rebuilding the RPM database. On that time, it works properly. But after some days, the same error occurs again

Let me know how to fix this permanently.

Thanks in Advance,

My answer:

You should remove the old corrupted RPM database and rebuild the RPM database. You can do these by running:

rm -f /var/lib/rpm/__db*
rpmdb --rebuilddb

Note that the usual cause of this problem is interrupting a package installation, update or removal. You should ensure that such actions are not interrupted by the user, and that your system has proper backup power (e.g. a UPS) to prevent a power failure from causing the problem.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.