CentOS rpmdb: PANIC: fatal region error detected; run recovery error

时间:2019-11-20 08:52:46  来源:igfitidea点击:

在CentOS Linux 6.3执行yum时,报错:

rpmdb: PANIC: fatal region error detected; run recovery  error: db3 error(-30974) from dbenv->open: 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

解决方案

清除rpm数据库

操作过程

备份 /var/lib/rpm/

mkdir /root/backups.rpm/
cp -avr /var/lib/rpm/ /root/backups.rpm/

查看__db文件

# ls -l /var/lib/rpm/_*

输出示例:

[root@theitroad ~]# ls -l /var/lib/rpm/_*
-rw-r--r--. 1 root root  270336 Dec 18 22:14 /var/lib/rpm/__db.001
-rw-r--r--. 1 root root   81920 Dec 18 22:14 /var/lib/rpm/__db.002
-rw-r--r--. 1 root root 1318912 Dec 18 22:14 /var/lib/rpm/__db.003

尝试解决yum安装问题

# rm -f /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all

重新执行yum操作

# yum update