fix the problem "yum rpmdb open failed" when installing apps on CentOS 7

fix the problem "yum rpmdb open failed" when installing apps on CentOS 7

修复CentOS 7安装软件yum rpmdb open failed问题

Table of contents

No heading

No headings in the article.

when trying to install applications on CentOS, you may get some errors like something below:

在centos系统上,在使用yum命令安装软件包时候报错:

rpmdb: Thread/process 35884/139793484506880 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.main:

Error: rpmdb open failed

the database of the RPM was broken is the reason for this issue, we can try to fix it by the commands below:

原因是RPM数据库被破坏,使用以下命令重建数据库后即可修复:

cd /var/lib/rpm
ls | grep 'db.'
rm -f __db.*
rpm --rebuilddb
yum clean all