Home >Operation and Maintenance >CentOS >What should I do if the yum software installation always fails under centos7?

What should I do if the yum software installation always fails under centos7?

王林
王林Original
2020-03-31 14:33:303859browse

What should I do if the yum software installation always fails under centos7?

Problem:

centos7 yum installation software failed: cannot open Packages database in /var/lib/rpm

Error: rpmdb open failed[root@cdhslave ~]# yum install ppp
error: rpmdb: BDB0113 Thread/process 26877/139823268095808 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:

Cause analysis:

Yum failed to install the software, most likely due to damage to the rpm local database.

(Recommended tutorial: centos tutorial)

Solution:

1. Enter the directory where rpmdb is located

[root@www~]# cd /var/lib/rpm      # rpmdb所在目录

2. Column Extract the relevant rpmdb files

[root@www rpm]# ls | grep 'db.'   # 列出相关rpmdb文件
   __db.001
   __db.002
   __db.003
   __db.004

3. Rename the original rpmdb files to files with .bak at the end

[root@www rpm]# for i in $(ls | grep 'db.');do mv $i $i.bak;done   # 将原rpmdb文件都更名为结尾带.bak的文件

or

4. Rebuild the rpm database

[root@www rpm]# rm -f __db.*     # 清除原rpmdb文件   
[root@www rpm]# rpm --rebuilddb     # 重建rpm数据库   
[root@www rpm]# yum clean all     # 清除所有yum的缓存

Related video tutorial recommendations: linux video tutorial

The above is the detailed content of What should I do if the yum software installation always fails under centos7?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn