Linux系统YUM提示错误

2022年03月15日

原创文章,转载请注明出处:https://www.myzhenai.com.cn/post/4062.html

刚才,我在更新我的一台aws服务器的时候,在使用yum upgrade更新的时候提示有几处错误,因为这个问题也折腾也好一会,所以现在在这里也写出解决方法,以免以后遇到类似问题的朋友们可以参考。

[root@ip- centos]# rpm -q centos-release
centos-release-7-9.2009.1.el7.centos.x86_64
[root@ip- centos]# yum upgrade -y
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                                | 6.1 kB  00:00:00     
 * base: download.cf.centos.org
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: download.cf.centos.org
 * updates: download.cf.centos.org
base                                                                                | 3.6 kB  00:00:00     
epel                                                                                | 4.7 kB  00:00:00     
extras                                                                              | 2.9 kB  00:00:00     
updates                                                                             | 2.9 kB  00:00:00     
(1/5): epel/x86_64/updateinfo                                                       | 1.1 MB  00:00:00     
(2/5): epel/x86_64/group_gz                                                         |  96 kB  00:00:00     
(3/5): epel/x86_64/primary_db                                                       | 7.0 MB  00:00:00     
(4/5): extras/7/x86_64/primary_db                                                   | 246 kB  00:00:00     
(5/5): updates/7/x86_64/primary_db                                                  |  14 MB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.8 will be updated
---> Package bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.9 will be an update
---> Package cloud-init.x86_64 0:19.4-7.el7.centos.5 will be updated
---> Package cloud-init.x86_64 0:19.4-7.el7.centos.6 will be an update
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-23.el7 will be updated
---> Package cyrus-sasl-lib.x86_64 0:2.1.26-24.el7_9 will be an update
---> Package kernel.x86_64 0:3.10.0-1160.59.1.el7 will be installed
---> Package kernel-debug-devel.x86_64 0:3.10.0-1160.53.1.el7 will be updated
---> Package kernel-debug-devel.x86_64 0:3.10.0-1160.59.1.el7 will be an update
---> Package kernel-headers.x86_64 0:3.10.0-1160.53.1.el7 will be updated
---> Package kernel-headers.x86_64 0:3.10.0-1160.59.1.el7 will be an update
---> Package kernel-tools.x86_64 0:3.10.0-1160.53.1.el7 will be updated
---> Package kernel-tools.x86_64 0:3.10.0-1160.59.1.el7 will be an update
---> Package kernel-tools-libs.x86_64 0:3.10.0-1160.53.1.el7 will be updated
---> Package kernel-tools-libs.x86_64 0:3.10.0-1160.59.1.el7 will be an update
---> Package openldap.x86_64 0:2.4.44-24.el7_9 will be updated
---> Package openldap.x86_64 0:2.4.44-25.el7_9 will be an update
---> Package python-perf.x86_64 0:3.10.0-1160.53.1.el7 will be updated
---> Package python-perf.x86_64 0:3.10.0-1160.59.1.el7 will be an update
Killed

遇到以上问题的时候,假如在使用yum的过程中提示Killed错误字样,那么多半是提示系统内存不足,我的解决方法是reboot重启系统,问题解决。

[root@ip- centos]# yum clean all
error: rpmdb: BDB0113 Thread/process 13435/139990340708160 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
[root@ip- centos]# yum makecache
error: rpmdb: BDB0113 Thread/process 13435/139990340708160 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

提示以上错误的时候,是因为数据库缓存出了问题,请执行以下删除命令进行删除几个数据库文件。

[root@ip- centos]# ls -l /var/lib/rpm/
total 106344
-rw-r--r--. 1 root root   3076096 Feb 11 16:41 Basenames
-rw-r--r--. 1 root root      8192 Feb 11 16:41 Conflictname
-rw-r--r--  1 root root    270336 Mar 15 11:59 __db.001
-rw-r--r--  1 root root     81920 Mar 15 11:59 __db.002
-rw-r--r--  1 root root   1318912 Mar 15 11:59 __db.003
-rw-r--r--. 1 root root   1523712 Feb 11 16:41 Dirnames
-rw-r--r--. 1 root root     16384 Feb 11 16:41 Group
-rw-r--r--. 1 root root     12288 Feb 11 16:41 Installtid
-rw-r--r--. 1 root root     28672 Feb 11 16:41 Name
-rw-r--r--. 1 root root     16384 Feb 11 13:27 Obsoletename
-rw-r--r--. 1 root root 100032512 Feb 11 16:41 Packages
-rw-r--r--. 1 root root   2371584 Feb 11 16:41 Providename
-rw-r--r--. 1 root root    176128 Feb 11 16:41 Requirename
-rw-r--r--. 1 root root     49152 Feb 11 16:41 Sha1header
-rw-r--r--. 1 root root     32768 Feb 11 16:41 Sigmd5
-rw-r--r--. 1 root root      8192 Feb 11 12:37 Triggername

当出现 _db.的文件的时候,执行任何yum命令都会出错,所以这里我们需要删除这几个文件。

[root@ip- ~]# rpm -q kernel
BDB2053 Freeing read locks for locker 0x10: 14312/140020965660480
BDB2053 Freeing read locks for locker 0x12: 14312/140020965660480
BDB2053 Freeing read locks for locker 0x13: 14312/140020965660480
BDB2053 Freeing read locks for locker 0x14: 14312/140020965660480
BDB2053 Freeing read locks for locker 0x15: 14312/140020965660480
kernel-3.10.0-1160.el7.x86_64
kernel-3.10.0-1160.15.2.el7.x86_64
kernel-3.10.0-1160.53.1.el7.x86_64

[root@ip- ~]# rm -rf /var/lib/rpm/__db.*
[root@ip- ~]# ls -l /var/lib/rpm/
total 104844
-rw-r--r--. 1 root root 3076096 Feb 11 16:41 Basenames
-rw-r--r--. 1 root root 8192 Feb 11 16:41 Conflictname
-rw-r--r--. 1 root root 1523712 Feb 11 16:41 Dirnames
-rw-r--r--. 1 root root 16384 Feb 11 16:41 Group
-rw-r--r--. 1 root root 12288 Feb 11 16:41 Installtid
-rw-r--r--. 1 root root 28672 Feb 11 16:41 Name
-rw-r--r--. 1 root root 16384 Feb 11 13:27 Obsoletename
-rw-r--r--. 1 root root 100032512 Feb 11 16:41 Packages
-rw-r--r--. 1 root root 2371584 Feb 11 16:41 Providename
-rw-r--r--. 1 root root 176128 Feb 11 16:41 Requirename
-rw-r--r--. 1 root root 49152 Feb 11 16:41 Sha1header
-rw-r--r--. 1 root root 32768 Feb 11 16:41 Sigmd5
-rw-r--r--. 1 root root 8192 Feb 11 12:37 Triggername
[root@ip- ~]# yum clean all

 


sicnature ---------------------------------------------------------------------
Your current IP address is: 100.25.42.211
Your IP address location: 美国弗吉尼亚阿什本 亚马逊云
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source https://myzhenai.com.cn/post/4062.html

没有评论

发表回复

您的电子邮箱地址不会被公开。