Post

Fixing rpmdb : Thread died in Berkeley DB library

When executing package management operations, encountering error messages indicating issues with the RPM database (rpmdb) is not uncommon. These errors often arise while using commands like yum or rpm, leading to failures in accessing the RPM database. One of the commonly seen error messages is as follows:

1
2
3
4
5
6
rpmdb: Thread/process 277623/140429100390144 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.verbose.cli.yumcompletets:Yum Error: 
Error: rpmdb open failed

Steps to Repair a Corrupted rpmdb

If you encounter issues with rpmdb, there are several steps you can take to address them. Here is a breakdown of these steps:

1. Backup and Reconstruct the rpmdb

a. Restart LVEStats

Begin by restarting the LVEStats service:

1
systemctl restart lvestats

b. Reconstruct the rpmdb

Next, reconstruct the rpmdb by executing the following command:

1
rpm --rebuilddb

c. Perform System Update

Perform a system update using the command:

1
yum -y update

2. Alternative Steps if the Initial Process Fails

If the previous steps do not succeed, there is an alternative to try:

a. Restart LVEStats and Create Database Backup

Start by restarting LVEStats and creating a backup of the rpmdb:

1
2
3
4
systemctl restart lvestats
mkdir /var/lib/rpm/backup
cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
rm -f /var/lib/rpm/__db.[0-9][0-9]*

b. Reconstruct the rpmdb (Second Attempt)

Reconstruct the rpmdb again:

1
2
rpm --quiet -qa
rpm --rebuilddb

c. Perform Update Again

Finally, perform a system update once more:

1
yum -y update

3. Using Alternative Commands for cPanel

In addition to the previous steps, there are alternative commands that can be attempted:

1
/scripts/upcp --force

Conclusion

Fixing rpmdb errors stemming from issues in the Berkeley DB library may take time, but the outlined steps generally assist in resolving such problems.

FAQ (Frequently Asked Questions)

1. What is rpmdb?

Rpmdb is a database utilized by the RPM package management system in Linux distributions.

2. Why does rpmdb get corrupted?

Rpmdb can become corrupted due to various reasons such as interruptions during write operations, system failures, or hardware failures.

3. Do these steps apply to all Linux distributions?

The steps generally apply to many Linux distributions; however, some steps might slightly differ depending on the distribution and version used.

4. Why is a system update necessary after reconstructing rpmdb?

A system update is necessary to ensure that the system utilizes the latest and most current database following the rpmdb reconstruction process.

5. How can one ensure that rpmdb has been fixed properly?

You can try executing yum or rpm commands after performing the repair steps to verify that rpmdb error messages no longer appear.

This post is licensed under CC BY 4.0 by the author.