rpm使用过程中的问题集
2009-11-25 10:48:23 阿炯

-------------------
rpmdb-Lock table is out of available locker entries
如果系统运行一些时间后,运行yum或rpm命令会出现:
“rpmdb: Lock table is out of available locker entries...”的问题时, 你可以按照如下操作来解决它:

错误表现如下:
[root@localhost ~]# rpm -aq
rpmdb: Lock table is out of available locker entries
rpmdb: Unknown locker ID: 1327
error: db4 error(22) from db->close: Invalid argument
error: cannot open Packages index using db3 - Cannot allocate memory (12)
error: cannot open Packages database in /var/lib/rpm

操作之前请先备份 /var/lib/rpm :
tar cvzf rpmdb-backup$(date +%y%m%d).tar.gz /var/lib/rpm

去除rpm使用的BDB数据库:
rm /var/lib/rpm/__db.00*

重建rpm使用的数据库,注意:此处可能花去不少时间:
rpm --rebuilddb

现在检查,看看 rpm 包是否一切正常:
rpm -aq
就不会再发生像上面所报的错误了。

为什么为发生这个问题呢?
其实当您用rpm命令后,rpm访问BDB数据库,首先会设置一个临时锁。如果在它运行时您用 control-c 中断它,或者是给它发了中断信号。那么rpm就很可能会出错误。因为这个临时锁还没有被释放,问题就这样产生了。

-------------------
specifies multiple packages

在卸载包时报这个错误。

# rpm -e --nodeps nss_ldap-253-21.el5

error: "nss_ldap-253-21.el5" specifies multiple packages

通过man rpm,发现–allmatches应该可以解决这个问题:

–allmatches
Remove all versions of the package which match PACKAGE_NAME. Normally an error is issued if PACKAGE_NAME matches multiple packages.

# rpm -e --allmatches nss_ldap-253-21.el5
warning: /etc/ldap.conf saved as /etc/ldap.conf.rpmsave

-------------------
Error: rpmdb open failed


# yum install lrzsz -y
错误:rpmdb: BDB0113 Thread/process 10484/140675904444224 failed: BDB1507 Thread died in Berkeley DB library
错误:db5 错误(-30973) 来自 dbenv->failchk:BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
错误:无法使用 db5 -  (-30973) 打开 Packages 索引
错误:无法从 /var/lib/rpm 打开软件包数据库
CRITICAL:yum.main:

Error: rpmdb open failed

The fix is, thankfully, rather easy: remove the RPM database, rebuild it and let yum download all the mirror's file lists.
mv /var/lib/rpm/__db* /tmp/
rpm --rebuilddb
yum clean all

The commands above are safe to run. If for some reason this does not fix, you can get the files back from the /tmp path where they were moved.

-------------------


-------------------



该文章最后由 阿炯 于 2019-06-21 15:55:40 更新,目前是第 2 版。