When running system updates using the dnf upgrade
(or dnf update
) command, you get the following error:
error: rpmdb: BDB0113 Thread/process failed: BDB1507 Thread died in Berkeley DB library
error: db5 error (-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
error: Error: rpmdb open failed
First, you should make a backup of the current RPM database, just in case:
mkdir /tmp/rpm-backup
cp -a /var/lib/rpm/__db* /tmp/rpm-backup/
Remove the old database:
rm -fv /var/lib/rpm/__db.[0-9]*
Then, clean and rebuild the RPM database:
rpm --quiet -qa
rpm --rebuilddb
yum clean all