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 ...
随机推荐
- QT学习:入门篇(三)
头文件: #ifndef CChatDisplaySet_h #define CChatDisplaySet_h #include "QtGui/QDialog" #include ...
- Win+PHP+IECapt完整实现网页批量截图并创建缩略图
最近在开发一个本地互联网应用的项目,为了增加用户体验,需要在搜索结果左侧显示如图一所示的某个网站的缩略图效果,在网上不停地百度谷歌了一上午后,发现大多数实现少量截图还是可以的,如果大批量的截图总会在中 ...
- canvas 绘制矩形
XXX(x,y,width,height) x矩形左上角x坐标 y矩形左上角y坐标 ...
- Spring4.0学习笔记(3) —— Spring_Bean之间的关系
1.继承关系 bean-relation.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...
- cxf所用的lib
cxf_lib
- Spark 资源调度及任务调度
1. 资源分配 通过SparkSubmit进行提交应用后,首先会创建Client将应用程序(字节码文件.class)包装成Driver,并将其注册到Master.Master收到Client的注册请 ...
- 系统共享内存的修改(ORA-27102: out of memory)
http://ccchencheng.blog.51cto.com/2419062/738188 http://blog.csdn.net/leshami/article/details/874602 ...
- Another Look at Events(再谈Events)
转载:http://www.qtcn.org/bbs/simple/?t31383.html Another Look at Events(再谈Events) 最近在学习Qt事件处理的时候发现一篇很不 ...
- Linux系统编程(30)—— socket编程之TCP/IP协议
在世界上各地,各种各样的电脑运行着各自不同的操作系统为大家服务,这些电脑在表达同一种信息的时候所使用的方法是千差万别.就好像圣经中上帝打乱了各地人的口音,让他们无法合作一样.计算机使用者意识到,计算机 ...
- 使用定制的ArrayAdapter制作ListView的Items(翻译)
Translated by:AcerWang 原文出自:customizing-android-listview-items-with-custom-arrayadapter 背景介绍 对于现 ...