This error: rpmdb: BDB0113 Thread/process occurs when running dnf or yum and indicates that your RPM package manager’s database is locked or corrupted.
This usually happens when:
- A package management process (such as yum, dnf, or rpm itself) is interrupted unexpectedly—for example, if the system crashes, the process is forcibly killed, or there’s a power outage.
- Lack of disk space.
- Others..
When this occurs, lock files may be left behind, preventing any other package process from accessing the database.
How to Solve (Step by Step)
Follow these steps carefully. You’ll need root permissions to run the commands. Use sudo before each command if necessary.
Step 1: Check that there are no YUM/DNF processes running
Before deleting any files, make sure no package managers are actually running in the background.
ps aux | grep -E 'yum|dnf'
If this command returns something other than the grep command itself, it means a process is active. Wait for it to finish or, if you’re sure it’s stuck, kill it with kill . If the command returns nothing, you can proceed.
Step 2: Remove the database lock files
Lock files are the cause of the lock. They usually start with __db in the RPM directory.
Run the following command as root:
rm -f /var/lib/rpm/__db.*
What this command does:
- rm -f: Forcibly removes (rm) the specified files without asking for confirmation.
- /var/lib/rpm/__db.*: The path to the RPM database lock files. The * ensures that all files beginning with __db. are removed.
Step 3: Rebuild the RPM Database
After removing the lock files, the database may be in an inconsistent state. The next step is to rebuild it to correct any issues.
Run the following command as root:
rpm --quiet -qa rpm --rebuilddb
What this command does:
- rpm –rebuilddb: Reads the headers of all installed packages and creates a new, clean, and functional database from scratch. This process is safe and does not remove any installed packages.
Step 4: Clear the package manager cache (Recommended)
To ensure everything works correctly, it’s a good practice to clear the cache of your package manager (yum or dnf).
If you’re using a CentOS/RHEL 7 or older system (which uses yum):
yum clean all
If you use a Fedora, CentOS/RHEL 8 or newer based system (which uses dnf):
dnf clean all
Summary
In 99% of cases, the following command sequence, executed as root, will resolve the issue:
# 1. Remove the lock files rm -f /var/lib/rpm/__db.* # 2. Rebuild the database from the installed packages rpm --quiet -qa rpm --rebuilddb # 3. (Optional) Clear the package manager cache # Use 'yum' or 'dnf', depending on your system yum clean all # or dnf clean all
After completing these steps, try using yum, dnf, or rpm again. The error should be gone.