不知道有没有跟我一样的小伙伴,在使用yum安装软件时,发现无法正常使用yum安装软件包,下面出现几句英语提示。在使用rpm时也无法正常的使用。其实 是rpm数据库崩溃导致的 下面就简单的介绍一下怎么回复,让其正常的工作,很简单几个命了即可。
1. 出现错误提示,这时我们需要认真的阅读下面的提示,不要乱找原因
[root@centos7 yum.repos.d]# vim YUM.repo
[root@centos7 yum.repos.d]# yum repolist
error: rpmdb: BDB0113 Thread/process 6396/140171373643584 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
CRITICAL:yum.main:
Error: rpmdb open failed
2.跟着提示cd /var/lib/rpm 下 查看文件 删除_db.* 所有文件
[root@centos7 yum.repos.d]# cd /var/lib/rpm
[root@centos7 rpm]# ls
Basenames __db.001 __db.003 Group Name Packages Requirename Sigmd5
Conflictname __db.002 Dirnames Installtid Obsoletename Providename Sha1header Triggername
[root@centos7 rpm]# rm _db.* -rf
3.删除后 用rpm –rebuilddb 进行数据文件回复
[root@centos7 rpm]# rpm –rebuilddb
[root@centos7 rpm]# ls
Basenames Dirnames Installtid Obsoletename Providename Sha1header Triggername
Conflictname Group Name Packages Requirename Sigmd5
4.用yum update 更新数据即可
[root@centos7 rpm]# yum update
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package httpd.x86_64 0:2.4.6-40.el7.centos will be updated
—> Package httpd.x86_64 0:2.4.6-45.el7.centos will be an update
—> Package httpd-tools.x86_64 0:2.4.6-40.el7.centos will be updated
—> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos will be an update
—> Package lftp.x86_64 0:4.4.8-7.el7 will be updated
—> Package lftp.x86_64 0:4.4.8-8.el7 will be an update
—> Package telnet.x86_64 1:0.17-59.el7 will be updated
—> Package telnet.x86_64 1:0.17-60.el7 will be an update
–> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Updating:
httpd x86_64 2.4.6-45.el7.centos base 2.7 M
httpd-tools x86_64 2.4.6-45.el7.centos base 84 k
lftp x86_64 4.4.8-8.el7 base 751 k
telnet x86_64 1:0.17-60.el7 base 63 k
Transaction Summary
===================================================================================================
Upgrade 4 Packages
Total download size: 3.6 M
Is this ok [y/d/N]: y
Downloading packages:
—————————————————————————————————
Total 20 MB/s | 3.6 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : httpd-tools-2.4.6-45.el7.centos.x86_64 1/8
Updating : httpd-2.4.6-45.el7.centos.x86_64 2/8
Updating : lftp-4.4.8-8.el7.x86_64 3/8
Updating : 1:telnet-0.17-60.el7.x86_64 4/8
Cleanup : httpd-2.4.6-40.el7.centos.x86_64 5/8
Cleanup : httpd-tools-2.4.6-40.el7.centos.x86_64 6/8
Cleanup : lftp-4.4.8-7.el7.x86_64 7/8
Cleanup : 1:telnet-0.17-59.el7.x86_64 8/8
Verifying : 1:telnet-0.17-60.el7.x86_64 1/8
Verifying : httpd-tools-2.4.6-45.el7.centos.x86_64 2/8
Verifying : httpd-2.4.6-45.el7.centos.x86_64 3/8
Verifying : lftp-4.4.8-8.el7.x86_64 4/8
Verifying : httpd-2.4.6-40.el7.centos.x86_64 5/8
Verifying : httpd-tools-2.4.6-40.el7.centos.x86_64 6/8
Verifying : 1:telnet-0.17-59.el7.x86_64 7/8
Verifying : lftp-4.4.8-7.el7.x86_64 8/8
Updated:
httpd.x86_64 0:2.4.6-45.el7.centos httpd-tools.x86_64 0:2.4.6-45.el7.centos
lftp.x86_64 0:4.4.8-8.el7 telnet.x86_64 1:0.17-60.el7
Complete!
5.rpm和yum 恢复正常使用
[root@centos7 rpm]# rpm -q ntp
ntp-4.2.6p5-25.el7.centos.x86_64
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base
Cleaning up everything
Cleaning up list of fastest mirrors
原创文章,作者:huchaowei,如若转载,请注明出处:http://www.178linux.com/78003