首页 > 代码库 > error: cannot open Packages database in /var/lib/rpm

error: cannot open Packages database in /var/lib/rpm

在使用rpm -ivh gcc-4.4.7-4.el6.x86_64.rpm命令安装GCC时,提示以下错误:

rpmdb: Thread/process 3343/139858349385472 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
warning: gcc-4.4.7-4.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
rpmdb: Thread/process 3343/139858349385472 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 database in /var/lib/rpm
解决方法:

执行以下命令即可搞定:
rm -rf /var/lib/rpm/__db*

error: cannot open Packages database in /var/lib/rpm