yum安装软件包提示Error: rpmdb open failed

 

使用yum命令安装软件包时候报错:

系统:centos

rpmdb: Thread/process 6539/140448388269824 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:

原因是RPM数据库被破坏

以root身份执行:

cd /var/lib/rpm/
for i in `ls | grep 'db.'`;do mv $i $i.bak;done # 将原rpmdb文件bak一下
rpm --rebuilddb #重建rpm数据库
yum clean all # 清除所有yum的缓存

你可能感兴趣的:(linux)