Error: “rpmdb open failed” – How to fix it?

Fix Error: “rpmdb open failed” in CentOS

Sometimes when you attempt to update your CentOS server by running yum update, you might run into the error rpmdb open failed. It is a most common error.

When I ran into this error for the first time, it didn’t make sense to me and I thought maybe it’s the Firewall. I checked the firewall settings and checked the repositories but couldn’t find anything odd. I tried to reboot the system as well but the error remained the same:

error: rpmdb: BDB0113 Thread/process 2196/139984719730496 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

This error could appear because the YUM broke which could happen due to multiple reasons. So, in order to fix the issue, you can follow these steps:

  • Firstly, back-up your rpm database:
# sudo mv /var/lib/rpm/__db* /tmp
  • Next, run this command:
# sudo yum clean all
  • Now, the issue should be fixed and you can run the yum update:
# sudo yum update
  • Finally, clean the back up made previously:
# rm -rfi /tmp/__db*

One thought on “Error: “rpmdb open failed” – How to fix it?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.