Articles on: Linux VPS

How to fix rpmdb Failed: Thread died in Berkeley DB library?

This error might output during yum operations or any rpm operations on Linux - based operating system:
[root@avengers ~]# yum -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

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

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/

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

Rebuild complete! You may try running the yum command once again and see if the issue has resolved.

Updated on: 21/06/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!