Updated: 28 September 2026 · Applies to: AlmaLinux 9, Rocky Linux 9, Ubuntu 24.04 and Debian 12

Errors such as "cannot open Packages database in /var/lib/rpm" or "rpmdb: Thread died in Berkeley DB library" mean the RPM package database is damaged or locked, so yum/dnf cannot run.

Fix (root)

  1. Make sure no other rpm, yum or dnf process is running: ps aux | grep -E "rpm|yum|dnf".
  2. Back up the database: cp -a /var/lib/rpm /root/rpm-backup-$(date +%F)
  3. On CentOS 7 and similar older systems, remove the stale lock files: rm -f /var/lib/rpm/__db.*.
  4. Rebuild the database: rpm --rebuilddb.
  5. Test: dnf clean all && dnf repolist (or yum).

Note: On AlmaLinux, Rocky Linux and RHEL 9, the RPM database is a single SQLite file, and rpm --rebuilddb alone is usually enough. On cPanel servers, WHM › Software › Rebuild RPM Database does the same.

Was dit antwoord nuttig?

Komt u er niet uit? Open een ticket