CentOS yum 错误分析解决

今天技安在yum自己的小云主机的时候,出现了一下错误:

$ yum -y update
rpmdb: Thread/process 28636/139844750771968 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:
Error: rpmdb open failed

大致的意思是rpmdb打开失败。于是google了一下

解决办法:

# 清除缓存
rm /var/lib/rpm/__db*
# 重建
rpm --rebuilddb

之后就可以正常的update了。