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

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

故障描述:今天下午测试OpenStack,在使用yum安装一个包的时候,手欠了下,结果被我终止了,如是有了下面的记录

先清空下缓存,发现rpmdb open failed

[root@linux-node1 glance]# yum clean all
error: rpmdb: BDB0113 Thread/process 21357/140557926295360 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)
CRITICAL:yum.main:
Error: rpmdb open failed

然后试了下yum makecache,问题仍旧不能解决

[root@linux-node1 glance]# yum makecache
error: rpmdb: BDB0113 Thread/process 21357/140557926295360 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

解决方法:

[root@linux-node1 glance]# ls /var/lib/rpm/
Basenames     __db.001      __db.003      Dirnames      Installtid    Obsoletename  Providename   .rpm.lock     Sigmd5
Conflictname  __db.002      .dbenv.lock   Group         Name          Packages      Requirename   Sha1header    Triggername
[root@linux-node1 glance]# rm -f /var/lib/rpm/__db*
You have new mail in /var/spool/mail/root
[root@linux-node1 glance]# rpm --rebuilddb
[root@linux-node1 glance]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base centos-ceph-hammer centos-openstack-mitaka centos-qemu-ev epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors

问题得到解决


本文出自 “冰冻vs西瓜” 博客,请务必保留此出处http://molewan.blog.51cto.com/287340/1906370

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