How to Solve Yum Error: db5 error(30973)

Problem error: failed to open rpmdb. db5 error(30973)

error: rpmdb: BDB0113 Thread/process 8442/140713489532992 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
CRITICAL:yum.main:

Error: rpmdb open failed
[[email protected] ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
error: rpmdb: BDB0113 Thread/process 8442/140713489532992 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
CRITICAL:yum.cli:Yum Error: Error: rpmdb open failed

The reason why rpm is damaged: the database needs to be rebuilt.

Solution: clear the original link through the command and re-establish it.

[[email protected] ~]# rm -rf /var/lib/rpm/_db*  #Delete the original
[[email protected] ~]# rpm --rebuilddb # New
[[email protected] ~]# yum clean all # Clear all yum caches

It can be used normally at present

Read More: