CentOS yum Fatal Error 处理一例

环境说明

[[email protected] ~]# cat  /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[[email protected] ~]# uname -r
3.10.0-229.7.2.el7.x86_64
[[email protected] ~]#

报错信息

[[email protected] ~]# yum  -y install  docker
error: rpmdb: BDB0113 Thread/process 38301/139855495489536 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] ~]#

处理步骤

1, rm -f /var/lib/rpm/__db*    # 删除/var/lib/rpm 目录下的__db开头的rpmdb文件
2, rpm --rebuilddb             # rpm数据库重建
3, yum clean all               # 清理所有yum缓存
4, yum makecache               # 重新生成yum缓存※: 此解决法方法在RHEL/CentOS 5(未测试),6,7系列的操作系统中都是适用的.

执行过程

[[email protected] ~]# cd  /var/lib/rpm
[[email protected] rpm]# ll  -htr
total 42M
-rw-r--r--. 1 root root 8.0K Feb 18 17:31 Triggername
-rw-r--r--. 1 root root  16K Feb 18 17:31 Obsoletename
-rw-r--r--. 1 root root 8.0K Feb 18 17:31 Conflictname
-rw-r--r--. 1 root root  32K Feb 18 17:31 Name
-rw-r--r--. 1 root root 2.4M Feb 18 17:31 Basenames
-rw-r--r--. 1 root root  16K Feb 18 17:31 Group
-rw-r--r--. 1 root root 200K Feb 18 17:31 Requirename
-rw-r--r--. 1 root root 1.5M Feb 18 17:31 Providename
-rw-r--r--. 1 root root 1.1M Feb 18 17:31 Dirnames
-rw-r--r--. 1 root root  12K Feb 18 17:31 Installtid
-rw-r--r--. 1 root root  40K Feb 18 17:31 Sigmd5
-rw-r--r--. 1 root root  52K Feb 18 17:31 Sha1header
-rw-r--r--. 1 root root  35M Feb 18 18:46 Packages
-rw-r--r--  1 root root 1.3M Feb 18 22:47 __db.003
-rw-r--r--  1 root root 104K Feb 18 22:47 __db.002
-rw-r--r--  1 root root 432K Feb 18 22:47 __db.001
[[email protected] rpm]# rm -f __db*
[[email protected] rpm]# rpm --rebuilddb
[[email protected] rpm]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[[email protected] rpm]# yum makecache
Loaded plugins: fastestmirror
base                                                         | 3.6 kB  00:00:00
epel/x86_64/metalink                                         | 5.7 kB  00:00:00
epel                                                         | 4.3 kB  00:00:00
extras                                                       | 3.4 kB  00:00:00
updates                                                      | 3.4 kB  00:00:00
(1/17): base/7/x86_64/group_gz                               | 155 kB  00:00:00
(2/17): base/7/x86_64/primary_db                             | 5.3 MB  00:00:05
(3/17): epel/x86_64/group_gz                                 | 169 kB  00:00:00
(4/17): base/7/x86_64/filelists_db                           | 6.2 MB  00:00:06
(5/17): extras/7/x86_64/filelists_db                         | 246 kB  00:00:00
(6/17): extras/7/x86_64/prestodelta                          |  16 kB  00:00:00
(7/17): extras/7/x86_64/primary_db                           |  90 kB  00:00:00
(8/17): epel/x86_64/other_db                                 | 1.8 MB  00:00:01
(9/17): epel/x86_64/primary_db                               | 3.9 MB  00:00:01
(10/17): base/7/x86_64/other_db                              | 2.3 MB  00:00:02
(11/17): extras/7/x86_64/other_db                            | 256 kB  00:00:00
(12/17): updates/7/x86_64/prestodelta                        | 239 kB  00:00:00
(13/17): updates/7/x86_64/filelists_db                       | 1.9 MB  00:00:01
(14/17): epel/x86_64/updateinfo                              | 488 kB  00:00:00
(15/17): updates/7/x86_64/primary_db                         | 3.1 MB  00:00:03
(16/17): epel/x86_64/filelists_db                            | 6.4 MB  00:00:03
(17/17): updates/7/x86_64/other_db                           |  26 MB  00:00:26
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * epel: mirrors.yun-idc.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Metadata Cache Created
[[email protected] rpm]# 

故障原因:

(原文地址:http://serverfault.com/questions/616666/why-does-yum-index-get-corrupted)

In the general case, this happens when rpm (or yum) crashes when updating the rpmdb, which is a Berkeley DB key-value store, and very sensitive. When such a crash happens, the rpmdb is left in an inconsistent state and this error occurs. All of the other files in /var/lib/rpm contain the same information, though in a less efficient format, so the database is easily rebuilt.

Two notable bugs you may have seen on older CentOS systems can cause this. The big one, a "nasty and subtle race in shared mmap‘ed page writeback" as it appears in the changelog, was quietly fixed in a kernel update in 2007. This one presented itself slightly differently than your report, though.

The one you might see from 2009 happened when PackageKit would kill yum at an inopportune time, and was also fixed. This would be more likely to affect desktop systems or servers with a GUI, though.

All of these bugs predate EL 6, and you should almost never see this occur on EL 6 or 7, nor should you see it if your EL 5 systems are up to date. (I have no idea about EL 4. If you have one, kill it before it spreads.) That said, anything that causes yum or rpm to die while working with the rpmdb could cause it. This includes what you‘re most likely to see these days, random cosmic rays flipping bits, or someone getting overzealous with kill -9.

In RHEL 7, yum traps more signals during the actual transaction run, and you‘ll see the message (shutdown inhibited). This should help prevent most situations in which someone or something interrupts the transaction and causes this problem.

更多关于yum的故障处理

请移步:http://xmodulo.com/how-to-fix-yum-errors-on-centos-rhel-or-fedora.html

文中涉及的错误类型包括下面7中:

1. Fix 404 Errors
2. Fix Connection Failure Errors
3. Fix Metadata Checksum Errors
4. Fix Yum Lock Errors
5. Fix Repository Database Read Errors
6. Fix Repository Metadata Read Errors
7. Fix Packages Database Error
时间: 2024-10-29 19:12:25

CentOS yum Fatal Error 处理一例的相关文章

CentOS YUM / RPM Error Signature Key ID BAD

现象; 执行yum 命令的时候 error: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: BAD 问题: 这个主要是在centos6上nss-softokn有bug 解决方式: #把key删掉 rpm -qa|grep gpg  rpm -e gpg-pubkey-c105b9de-4e0fd3a3 wget http://mirror.centos.org/centos/6/os/x86_64/Packag

php提示Fatal error: Call to undefined function imagecreate()

在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会 undefined 在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会提示Call to undefined function imagecreate()错

lua.c:80:31: fatal error: readline/readline.h: No such file or directory

make linuxcd src && make linuxmake[1]: Entering directory `/root/lua/lua-5.3.2/src'make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"make[2]: Entering directory `/root/lua/lua-5.3.2/src'gcc -std=gnu99 -O2 -Wa

linux重新编译安装gd,增加freetype支持,解决验证码不显示问题,Fatal error: Call to undefined function imagettftext()

问题: Fatal error: Call to undefined function Think\imagettftext() in /var/www/webreg/ThinkPHP/Library/Think/Verify.class.php on line 143 查看phpinfo()后得知,gd中没有freetype的支持 解决: 首先安装freestyle,php-gd 确保先安装freestyle,然后是php-gd:如果是先安装了php-gd,那么在安装完freestyle后,需

PHP Fatal error: Call to undefined function mysql_pconnect()

[[email protected] caishenye]# tail -f /data/caishenye/sa_9_0.log PHP Warning:  mkdir(): No such file or directory in /data/caishenye/sa_9_0.php on line 18 PHP Fatal error:  Call to undefined function mysql_pconnect() in /data/caishenye/sa_9_0.php on

linux 部署出现Fatal error: Class 'DOMDocument' not found。

今天用PHP解析xml时出现如下错误:php Fatal error:  Class 'DOMDocument' not found. 环境:CentOS 5.6; PHP 5.3.5 解决方法: #yum -y install php-dom #apachectl restart  或者 service httpd restart linux 部署出现Fatal error: Class 'DOMDocument' not found.

centos yum方式安装net-snmp v3

SNMPv3的安全报头采用用户安全模式(USM),其提供具有机密性和完整性的网络管理通信.机密性通过采用数据加密标准(DES)来提供.尽管 这一算法以脆弱性著称(由于它采用的是40位的密钥),但与明文community strings相比,它具有显著的优点.即使象DES这样的脆弱算法仍要协同攻击才能攻破,因此你至少可以防范偶然的偷听者. 完整性服务通 过散列信息认证码算法与安全散列功能: MD5 或安全散列算法(SHA-1)之一相结合提供.采用hashes保证了SNMP设备可以知道信息在传输中没

centos yum安装高版本php,apache,mysql

1.检查当前安装的PHP包 yum list installed | grep php 或者   yum list installed php* 如果要删除,可执行 yum remove php.x86_64 php-cli.x86_64 2.rpm包 CentOs 6.xrpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm CentOs 7.Xrpm -Uvh https://mirror.webtatic.com/yum/el7/epe

Fatal error: Using $this when not in object context in C:\AppServ\www\ABC\model\Model.class.php on line 7

原文转发:http://hi.baidu.com/zwnjiejie/blog/item/5e6555c23fa302120ff477dd.html Fatal error Using $this when not in object context in D:\xampp\htdocs\test\php\service\FileCommand.php 大致意思是 $this 没有上下文,原因是没有对此类进行实例化. 出现此错误的原因是:在FileCommand.php中使用 $this->方法