CentOS and yum – Error: rpmdb open failed · uwot.eu
another meaningless subtitle

CentOS and yum – Error: rpmdb open failed

· by fabio · Read in about 1 min · (119 Words)
CentOS CentOS 7 yum

Today I had Ansible reporting an error on one of my CentOS machines while performing the usual upgrade procedure.
I SSH’d into the host to check what was wrong and run “yum clean all && yum update” manually just to be greeted with the following error:

rpmdb: PANIC: fatal region error detected; run recovery
error: db3 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm

Error: rpmdb open failed

The solution to the issue luckily was fairly simple and quick:

# cp -vr /var/lib/rpm /home/user
# rm -rf /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all && yum update