Resolved: "rpmdb Failed: Thread died in Berkely DB library"

This article discusses how to resolve "rpmdb Failed: Thread died in Berkely DB library" error on Linux server.

Steps to Reproduce

This error might output during dnf operations or any rpm operations on Linux - based operating system:

# dnf -y update
rpmdb: Thread/process 1339895/140650362885888 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:

Error: rpmdb open failed

How to Resolve "rpmdb Failed: Thread died in Berkely DB library"

The error above means your rpm database is corrupted and will block you from running any dnf or rpm operations. To solve this issue, simply run the steps below to backup and rebuild the rpm database:

  1. Run backup for the current rpm databases by creating a new directory for the current rpm databases backup. Copy the current files to the backup directory:
    mkdir /var/lib/rpm/backup
    cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
  2. Remove the current rpm database files and rebuild the database with the following commands:
    rm -f /var/lib/rpm/__db.[0-9][0-9]*
    rpm --quiet -qa
    rpm --rebuilddb
    yum clean all
  3. Rebuild complete!

You may now reattempt your previous command to verify that the issue is resolved.

Conclusion

You now know how to resolve "rpmdb Failed: Thread died in Berkely DB library" error.

  • dnf, rpm
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...

htaccess RewriteRule Examples

Here are some useful mod_rewrite RewriteRule redirect examples that you can use in your .htaccess...

Using htaccess File to Block IPs

If your webserver is Apache, you may block access to your website from specific IP addresses...