yum错误—TypeError: rpmdb open failed

林继 VPS 知识 4,067 共写了1275个字 (2012-03-18 11:43:50) 没有评论 打印 扫描二维码 百度未收录

一、错误信息

今天使用yum的时候出现的报错,如下是报错和解决的办法
rpmdb: Thread/process 28879/3086964416 failed: Thread died in Berkeley DB library
error: db4 error(-30975) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 – (-30975)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 229, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 84, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 184, in getOptionsConfig
enabled_plugins=self.optparser._splitArg(opts.enableplugins))
File “/usr/lib/python2.5/site-packages/yum/__init__.py”, line 192, in _getConfig
self._conf = config.readMainConfig(startupconf)
File “/usr/lib/python2.5/site-packages/yum/config.py”, line 774, in readMainConfig
yumvars[‘releasever’] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File “/usr/lib/python2.5/site-packages/yum/config.py”, line 844, in _getsysver
idx = ts.dbMatch(‘provides’, distroverpkg)
TypeError: rpmdb open failed

yum 错误TypeError: rpmdb open failed

二、分析原因

因为RPM数据库出现损坏导致的,它导致所有的软件的升级、安装甚至是删除都会出现问题,终端出现乱码,YUMEX也用不成,RPM命令 也用不成。原因是RPM数据库被破坏

三、解决方法

  1. su  - root
  2. cd /var/lib/rpm/
  3. for i in 'ls | grep 'db.'';do mv $i $i.bak;done #做一下备份
  4. rpm --rebuilddb #重建该数据库(rebuild the database indices from the installed package headers)
  5. yum clean all

注意区别:–rebuilddb:重建已经安装的RPM资料库 ,–initdb:创建一个新的RPM资料库

历史上的今天

3月
18

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

< >