赞
踩
本篇博客为执行yum clean all 报 rpmdb open failed 错误提供解决方案。
报错
# 用 yum 安装软件时进程被终止,执行 yum clean all 操作报 rpmdb open failed 错误
[root@tencent ~]# yum clean all
Error: rpmdb open failed
解决办法
[root@tencent ~]# cd /var/lib/rpm
[root@tencent rpm]# ll
total 212360
-rw-r--r--. 1 root root 7028736 Aug 11 16:29 Basenames
-rw-r--r--. 1 root root 20480 May 15 16:57 Conflictname
-rw-r--r-- 1 root root 270336 Aug 11 16:29 __db.001
-rw-r--r-- 1 root root 81920 Aug 11 16:29 __db.002
-rw-r--r-- 1 root root 1318912 Aug 11 16:29 __db.003
-rw-r--r--. 1 root root 3944448 Aug 11 16:29 Dirnames
-rw-r--r--. 1 root root 32768 Aug 11 16:29 Group
-rw-r--r--. 1 root root 32768 Aug 11 16:29 Installtid
-rw-r--r--. 1 root root 98304 Aug 11 16:29 Name
-rw-r--r--. 1 root root 40960 Jun 22 20:27 Obsoletename
-rw-r--r--. 1 root root 200728576 Aug 11 16:29 Packages
-rw-r--r--. 1 root root 2715648 Aug 11 16:29 Providename
-rw-r--r--. 1 root root 720896 Aug 11 16:29 Requirename
-rw-r--r--. 1 root root 184320 Aug 11 16:29 Sha1header
-rw-r--r--. 1 root root 122880 Aug 11 16:29 Sigmd5
-rw-r--r--. 1 root root 8192 Jun 22 21:03 Triggername
[root@tencent rpm]# rm -rf __db.* # 清除原 rpmdb 文件
[root@tencent rpm]# rpm --rebuilddb # 重建 rpm 数据库
[root@tencent rpm]# yum clean all # 清除所有 yum 缓存
如果以上方法未能解决问题,请使用如下方法在继续操作:
#检查yum源配置文件
[root@tencent yum.repos.d]# ll
total 64
-rw-r--r-- 1 root root 614 Mar 29 17:09 CentOS-Base.repo
-rw-r--r-- 1 root root 1309 Nov 23 2018 CentOS-CR.repo
-rw-r--r-- 1 root root 649 Nov 23 2018 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 230 Mar 29 17:09 CentOS-Epel.repo
-rw-r--r-- 1 root root 314 Nov 23 2018 CentOS-fasttrack.repo
-rw-r--r-- 1 root root 630 Nov 23 2018 CentOS-Media.repo
-rw-r--r-- 1 root root 1331 Nov 23 2018 CentOS-Sources.repo
-rw-r--r-- 1 root root 5701 Nov 23 2018 CentOS-Vault.repo
-rw-r--r-- 1 root root 194 May 15 16:48 docker-main.repo
-rw-r--r-- 1 root root 951 Oct 3 2017 epel.repo
-rw-r--r-- 1 root root 1050 Oct 3 2017 epel-testing.repo
-rw-r--r-- 1 root root 472 Jan 5 2018 nodesource-el7.repo
-rw-r--r-- 1 root root 963 Oct 9 2014 webtatic-archive.repo
-rw-r--r-- 1 root root 865 Oct 9 2014 webtatic.repo
-rw-r--r-- 1 root root 963 Oct 9 2014 webtatic-testing.repo
#更新yum源
[root@tencent yum.repos.d]# yum update -y --skip-broken
#清除所有yum缓存
[root@tencent yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Cleaning repos: docker-main-repo epel extras nodesource os updates webtatic
Cleaning up list of fastest mirrors
#重建yum缓存
[root@tencent yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks
Repository epel is listed more than once in the configuration
Determining fastest mirrors
* webtatic: uk.repo.webtatic.com
docker-main-repo | 2.9 kB 00:00:00
epel | 5.3 kB 00:00:00
extras | 3.4 kB 00:00:00
nodesource | 2.5 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 3.4 kB 00:00:00
webtatic | 3.6 kB 00:00:00
(1/29): docker-main-repo/primary_db | 34 kB 00:00:00
(2/29): docker-main-repo/filelists_db | 40 kB 00:00:00
(3/29): epel/7/x86_64/group_gz | 88 kB 00:00:00
(4/29): docker-main-repo/other_db | 652 kB 00:00:00
(5/29): epel/7/x86_64/updateinfo | 991 kB 00:00:00
(6/29): epel/7/x86_64/prestodelta | 1.6 kB 00:00:00
(7/29): epel/7/x86_64/primary_db | 6.8 MB 00:00:00
(8/29): epel/7/x86_64/filelists_db | 11 MB 00:00:01
(9/29): epel/7/x86_64/other_db | 3.3 MB 00:00:00
(10/29): epel/7/x86_64/updateinfo_zck | 1.4 MB 00:00:00
(11/29): extras/7/x86_64/prestodelta | 73 kB 00:00:00
(12/29): extras/7/x86_64/filelists_db | 249 kB 00:00:00
(13/29): extras/7/x86_64/primary_db | 215 kB 00:00:00
(14/29): extras/7/x86_64/other_db | 131 kB 00:00:00
(15/29): nodesource/x86_64/primary_db | 46 kB 00:00:00
(16/29): os/7/x86_64/group_gz | 166 kB 00:00:00
(17/29): nodesource/x86_64/other_db | 7.0 kB 00:00:00
(18/29): nodesource/x86_64/filelists_db | 636 kB 00:00:01
(19/29): os/7/x86_64/primary_db | 6.0 MB 00:00:00
(20/29): os/7/x86_64/filelists_db | 7.1 MB 00:00:01
(21/29): updates/7/x86_64/prestodelta | 945 kB 00:00:00
(22/29): os/7/x86_64/other_db | 2.6 MB 00:00:00
(23/29): updates/7/x86_64/filelists_db | 5.2 MB 00:00:00
(24/29): updates/7/x86_64/other_db | 764 kB 00:00:00
(25/29): updates/7/x86_64/primary_db | 7.4 MB 00:00:00
(26/29): webtatic/x86_64/group_gz | 448 B 00:00:01
(27/29): webtatic/x86_64/filelists_db | 67 kB 00:00:02
(28/29): webtatic/x86_64/other_db | 43 kB 00:00:00
(29/29): webtatic/x86_64/primary_db | 179 kB 00:00:02
Metadata Cache Created
测试
[root@tencent yum.repos.d]# yum install -y wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: mirror01.idc.hinet.net
* extras: mirrors.cn99.com
* updates: mirrors.cn99.com
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================
Package Arch Version Repository Size
=======================================================================================================
Installing:
wget x86_64 1.14-18.el7_6.1 updates 547 k
Transaction Summary
=======================================================================================================
Install 1 Package
Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : wget-1.14-18.el7_6.1.x86_64 1/1
Verifying : wget-1.14-18.el7_6.1.x86_64 1/1
Installed:
wget.x86_64 0:1.14-18.el7_6.1
Complete!
# 已成功解决 Error: rpmdb open failed
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。