使用yum时用Ctrl+C强制终止出现的Error: rpmdb open failed解决方案

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用yum时用Ctrl+C强制终止出现的Error: rpmdb open failed解决方案相关的知识,希望对你有一定的参考价值。


刚才为了写有关yum的博客,我在我的CentOS7操作系统使用yum -h想把里边的信息复制出来整理一下大家讲一下yum的具体操作,由于我不小心把yum -h里边的内容给复制到shell命令行了,这下子倒霉了,不断的有yum …… 的命令出现,于是我不断使用ctrl+C快捷键进行命令终止操作,当所有操作都终止了,以下问题出现了:

[[email protected] ~]# yum clean all

error: rpmdb: BDB0113 Thread/process 58171/139859184105280 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

[[email protected] ~]# yum grouplist

error: rpmdb: BDB0113 Thread/process 58171/139859184105280 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

[[email protected] ~]# yum --help

error: rpmdb: BDB0113 Thread/process 58171/139859184105280 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


以上所有用到yum的操作都有一个同样的问题那就是:

error: rpmdb: BDB0113 Thread/process 58171/139859184105280 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、根据提示我们可以知道rpm数据库在yum安装过程中使用Ctrl+C给损坏了,需要我们重新构建,下面是重新构建的方法及步骤:

[[email protected] Packages]# cd /var/lib/rpm

[[email protected] rpm]# ls

Basenames     __db.001  __db.003  Group       Name          Packages     Requirename  Sigmd5

Conflictname  __db.002  Dirnames  Installtid  Obsoletename  Providename  Sha1header   Triggername

[[email protected] rpm]# rm __db.* -rf                #删除rpm库

[[email protected] rpm]# rpm --rebuilddb              #rpm的重新构建命令

[[email protected] rpm]# yum clean all                #用yum clean all重新测试

Loaded plugins: fastestmirror, langpacks

Cleaning repos: c7-media

Cleaning up everything

Cleaning up list of fastest mirrors


[[email protected] rpm]# yum grouplist                #用yum grouplist 命令重新测试

Loaded plugins: fastestmirror, langpacks

c7-media                                                                                                                | 3.6 kB  00:00:00     

(1/2): c7-media/group_gz                                                                                                | 155 kB  00:00:00     

(2/2): c7-media/primary_db                                                                                              | 2.8 MB  00:00:00     

Determining fastest mirrors

Installed Environment Groups:

   Server with GUI

Available Environment Groups:

   Minimal Install

   Compute Node

   Infrastructure Server

   File and Print Server

   Basic Web Server

   Virtualization Host

   GNOME Desktop

   KDE Plasma Workspaces

   Development and Creative Workstation

Installed Groups:

   Compatibility Libraries

   Development Tools

Available Groups:

   Console Internet Tools

   Graphical Administration Tools

   Legacy UNIX Compatibility

   Scientific Support

   Security Tools

   Smart Card Support

   System Administration Tools

   System Management

Done


OK,成功了,问题解决了。


本文出自 “放牛娃” 博客,请务必保留此出处http://fangniuwa.blog.51cto.com/10209030/1750680

以上是关于使用yum时用Ctrl+C强制终止出现的Error: rpmdb open failed解决方案的主要内容,如果未能解决你的问题,请参考以下文章

使用yum时用Ctrl+C强制终止出现的Error: rpmdb open failed解决方案

WIN10中的Git Bash Ctrl C无法终止

Linux:shell基础 :Bash常用快捷键

如何在LinuxShell中强制python退出

如何在LinuxShell中强制python退出

执行yum相关命令总是卡住,ctrl+c也退出不了