首页  :: 新随笔  :: 管理

问题背景

针对系统漏洞扫描,对部分包进行rpm -Uvh升级时报如下的错误:

[root]# rpm -Uvh polkit-0.112-26.el7_9.1.x86_64.rpm 
error: db5 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db5 - Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
warning: polkit-0.112-26.el7_9.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: db5 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages database in /var/lib/rpm

此报错是因为rpm的库被损坏,需要重建rpmdb库。

处理步骤

删除rpmdb库

[root]# cd /var/lib/rpm
[root]# rm -fr __db.*

重建rpmdb库

[root]#rpm --rebuilddb
[root]#yum clean all
[root]#yum makecache

升级包polkit包

[root]# rpm -Uvh sudo-1.9.5-3.el7.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:sudo-1.9.5-3.el7                 warning: /etc/sudoers created as /etc/sudoers.rpmnew
################################# [ 50%]
Cleaning up / removing...
   2:sudo-1.8.23-3.el7                ################################# [100%]