博客园  :: 首页  :: 管理

关于rpm -qa命令报错-cannot open Packages database的解决方法

Posted on 2022-01-21 12:05  520_1351  阅读(1449)  评论(0编辑  收藏  举报

最近在一台linux服务器上,执行rpm -qa命令时,报如下错误:

[root@qq_5201351 ~]# rpm -qa
error: rpmdb: BDB0113 Thread/process 1685/139832756086336 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
error: rpmdb: BDB0113 Thread/process 1685/139832756086336 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
[root@qq_5201351 ~]# 

通过各种资料查询才知道,原因是系统已经安装的rpm包数据信息-数据库损坏

解决方法,重新构建rpm信息数据库:

[root@qq_5201351 ~]# cp -a /var/lib/rpm /var/lib/rpm.bak.202201
[root@qq_5201351 ~]# cd /var/lib/rpm
[root@qq_5201351 ~]# rm -f __db.*
[root@qq_5201351 ~]# rpm --rebuilddb

然后再次执行rpm -qa 命令进行查询,就正常查询出系统中安装的rpm包软件了,问题解决~

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/15829746.html