CentOS yum Fatal Error 处理一例
环境说明
[root@thatsit ~]# cat /etc/redhat-release
CentOS Linux release 7.1. (Core)
[root@thatsit ~]# uname -r
3.10.-229.7..el7.x86_64
[root@thatsit ~]#
报错信息
[root@thatsit ~]# yum -y install docker
error: rpmdb: BDB0113 Thread/process / failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main: Error: rpmdb open failed
[root@thatsit ~]#
处理步骤
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系列的操作系统中都是适用的.
执行过程
[root@thatsit ~]# cd /var/lib/rpm
[root@thatsit rpm]# ll -htr
total 42M
-rw-r--r--. root root .0K Feb : Triggername
-rw-r--r--. root root 16K Feb : Obsoletename
-rw-r--r--. root root .0K Feb : Conflictname
-rw-r--r--. root root 32K Feb : Name
-rw-r--r--. root root 2.4M Feb : Basenames
-rw-r--r--. root root 16K Feb : Group
-rw-r--r--. root root 200K Feb : Requirename
-rw-r--r--. root root 1.5M Feb : Providename
-rw-r--r--. root root 1.1M Feb : Dirnames
-rw-r--r--. root root 12K Feb : Installtid
-rw-r--r--. root root 40K Feb : Sigmd5
-rw-r--r--. root root 52K Feb : Sha1header
-rw-r--r--. root root 35M Feb : Packages
-rw-r--r-- root root 1.3M Feb : __db.
-rw-r--r-- root root 104K Feb : __db.
-rw-r--r-- root root 432K Feb : __db.
[root@thatsit rpm]# rm -f __db*
[root@thatsit rpm]# rpm --rebuilddb
[root@thatsit rpm]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[root@thatsit rpm]# yum makecache
Loaded plugins: fastestmirror
base | 3.6 kB ::
epel/x86_64/metalink | 5.7 kB ::
epel | 4.3 kB ::
extras | 3.4 kB ::
updates | 3.4 kB ::
(/): base//x86_64/group_gz | kB ::
(/): base//x86_64/primary_db | 5.3 MB ::
(/): epel/x86_64/group_gz | kB ::
(/): base//x86_64/filelists_db | 6.2 MB ::
(/): extras//x86_64/filelists_db | kB ::
(/): extras//x86_64/prestodelta | kB ::
(/): extras//x86_64/primary_db | kB ::
(/): epel/x86_64/other_db | 1.8 MB ::
(/): epel/x86_64/primary_db | 3.9 MB ::
(/): base//x86_64/other_db | 2.3 MB ::
(/): extras//x86_64/other_db | kB ::
(/): updates//x86_64/prestodelta | kB ::
(/): updates//x86_64/filelists_db | 1.9 MB ::
(/): epel/x86_64/updateinfo | kB ::
(/): updates//x86_64/primary_db | 3.1 MB ::
(/): epel/x86_64/filelists_db | 6.4 MB ::
(/): updates//x86_64/other_db | MB ::
Determining fastest mirrors
* base: mirrors.aliyun.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Metadata Cache Created
[root@thatsit 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
CentOS yum Fatal Error 处理一例的更多相关文章
- Yum出错Error: Cannot find a valid baseurl for repo: base(转)
centos yum 错误 Error: Cannot find a valid baseurl for repo: base 装了个CentOS 6.x,使用yum时出现了下面的错误提示.Loade ...
- Yum出错Error: Cannot find a valid baseurl for repo: base
centos yum 错误 Error: Cannot find a valid baseurl for repo: addons 装了个CentOS 6.5,使用yum时出现了以下的错误提示. [r ...
- centos 7安装mysql 执行./scripts/mysql_install_db --user=mysql 报错 FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db: Data::Dumper
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysql FATAL ERROR: please install the fol ...
- yum 安装报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
[root@venn09 ~]# yum install -y vim Loaded plugins: fastestmirror Could not retrieve mirrorlist http ...
- Centos 7.5源码编译安装zabbix4.0报fatal error: mysql.h: No such file or directory
系统环境:CentOS 7.5是最小化安装的 编译信息 编译选项: root@Server01 zabbix-]# ./configure --prefix=/usr/share/applicatio ...
- 转载: LINK : fatal error LNK1104: 无法打开文件“mfc71.lib”的原因又一例
转载地址:http://blog.csdn.net/mxclxp/article/details/8196142 LINK : fatal error LNK1104: 无法打开文件“mfc71.li ...
- php提示Fatal error: Call to undefined function imagecreate()
在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要GD库支持,如果没有开启GD库使用时会 / ...
- 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 ...
- fatal error: openssl/evp.h: 没有那个文件或目录
在陆佳华<嵌入式系统软硬件协同设计实战指南 第2版>一书的第13章节 编译U-boot时会遇到2个错误.原因很简单,就从一开始的错误提示着手: fatal error: openssl/e ...
随机推荐
- django安装
见 http://jingyan.baidu.com/article/466506580e7d29f549e5f8b6.html 下载安装python下载解压django cmd进入django目录, ...
- MySQL是否在扫描额外的记录
在确定查询只是返回需要的数据之后,接下来应该看看查询为了返回结果是否扫描了过多的数据.对于MySQL,最简单的衡量查询开销的三个指标如下: 1响应时间,2扫描行数,3返回行数 没有那个指明能够完美的衡 ...
- webservice: Could not initialize Service NoSuchMethodException getPortClassMap()
今天用apache-cxf-3.1.1的wsdl2java生成webservice文件,调用的时候出了问题 报错:Could not initialize Service NoSuchMethodEx ...
- 【回忆1314】第一次用AngularJS
1.创建指令的4种方式(ECMA) var appModule = angular.module('app', []); appModule.directive('hello', function() ...
- php 用post请求调用接口api
$post_data=""; $ch = curl_init(); $url = ''; curl_setopt($ch , CURLOPT_URL , $url); curl_s ...
- destoon程序中qq号码,手机号,msn必选项实现方法
最近发现好多客户,信息不完全!还是把qq号码,手机号,msn设为必选项比较好!下面以把qq设为必选项为例找到模板 template/default/member/edit.htm 找到 functio ...
- DotNET知识点总结三(笔记整合)
使用接口的注意事项: 接口中的成员不能加访问修饰符 接口中的成员不能有任何实现 实现接口的子类必须实现接口的全部成员 一个类可以同时继承一个类并实现多个接口,如果一个子类同时继承了父类A,并实现了接口 ...
- 完全教程 Aircrack-ng来PJ---WEP、WPA-PSK--加密利器
恩,先说明一下,本章的内容适用于目前市面所有主流品牌无线路由器或AP如Linksys.Dlink.TPLink.BelKin等.涉及内容包括了WEP加密及WPA-PSK加密的无线网络的破解操作实战. ...
- 转:关于copy_to_user()和copy_from_user()的一些用法
一.Copy_to_user( to, &from, sizeof(from)) To:用户空间函数 (可以是数组) From:内核空间函数(可以是数组) sizeof(from):内核空间 ...
- SQL Server 与 Entity Framework 级联删除
SQL Server 级联设置我就不多说了,网上很多教程. 我想提的是 cycles or multiple cascade paths 的问题. 简单的说如果你的级联设置不是一个树型,而是一个带有循 ...