使用yum安装软件时出现Error: rpmdb open failed,报错信息显示rpm数据库被损坏。
error: rpmdb: BDB0113 Thread/process 4291/140180325525568 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
解决方案:重建rpm数据库
[root@hackhp ~]# cd /var/lib/rpm [root@hackhp rpm]# ls Basenames __db.001 __db.003 Group Name Packages Requirename Sigmd5 Conflictname __db.002 Dirnames Installtid Obsoletename Providename Sha1header Triggername [root@hackhp rpm]# rm __db.* -rf [root@hackhp rpm]# ls Basenames Dirnames Installtid Obsoletename Providename Sha1header Triggername Conflictname Group Name Packages Requirename Sigmd5 [root@hackhp rpm]# rpm --rebuilddb [root@hackhp rpm]# yum clean all Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Cleaning repos: aegisbase aegisextras aegisupdates base docker-ce-stable epel extras updates Cleaning up list of fastest mirrors Other repos take up 560 k of disk space (use --verbose for details)