yum error: cannot open Packages database in /var/lib/rpm

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了yum error: cannot open Packages database in /var/lib/rpm相关的知识,希望对你有一定的参考价值。


1、前提条件:安装软件包的时候,被我手动终止了
[[email protected] yum.repos.d]# yum clean all
rpmdb: Thread/process 4541/140619363587840 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: 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
[[email protected] yum.repos.d]# yum makecache
rpmdb: Thread/process 4541/140619363587840 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: 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:

 

2、根据提示可以知道rpm数据库被损坏,如是按照下面的方法进行重建
[[email protected] yum.repos.d]# cd /var/lib/rpm/
[[email protected] rpm]# ls
Basenames     __db.004     Name            Pubkeys         Triggername
Conflictname  Dirnames     Obsoletename    Requirename
__db.001      Filedigests  Packages        Requireversion
__db.002      Group        Providename     Sha1header
__db.003      Installtid   Provideversion  Sigmd5
[[email protected] rpm]# rm __db.* -rf
[[email protected] rpm]# rpm --rebuilddb

[[email protected] rpm]# yum clean all
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id,
              : refresh-packagekit, security, subscription-manager, tmprepo,
              : verify, versionlock
Updating certificate-based repositories.
Unable to read consumer identity
Loading support for Red Hat kernel ABI
Cleaning repos: rhel-source
Cleaning up Everything
0 delta-package files removed, by presto
[[email protected] rpm]# yum update
Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id,
              : refresh-packagekit, security, subscription-manager, tmprepo,
              : verify, versionlock
Updating certificate-based repositories.
Unable to read consumer identity
Loading support for Red Hat kernel ABI
rhel-source                                                | 4.0 kB     00:00 ...
rhel-source/primary_db                                     | 3.1 MB     00:00 ...
Setting up Update Process
No Packages marked for Update



本文出自 “刘庆辉” 博客,请务必保留此出处http://liuqh.blog.51cto.com/10044913/1901184

以上是关于yum error: cannot open Packages database in /var/lib/rpm的主要内容,如果未能解决你的问题,请参考以下文章

《MySQL系列-部署维护》MySQL启动异常:error while loading shared libraries: libncurses.so.5: cannot open shared...

运行yum报错Error: Cannot retrieve metalink for reposit

yum 报错 Error: Cannot find a valid baseurl for repo: base

error: cannot open Packages database in /var/lib/rpm

error: cannot open Packages database in /var/lib/rpm

Linux关于yum命令Error: Cannot retrieve repository metadata (repomd.xml) for repository:xxxxxx.