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 ...
随机推荐
- C# linq的学习及使用
linq可以对多种数据源和对象进行查询,如数据库.数据集.XML文档.数组等. 通过对linq的使用,可以减少代码量并优化检索操作. LINQ关键字 from 指定数据源和范围变量 where 根据布 ...
- linux入门。删除不用到内核,为boot分区释放空间
在终端中输入如下命令: dpkg --get-selections|grep linux-image 这时会列出系统中所有到内核. 你可以使用 uname -a 查看你当前使用到内核. 然后用 sud ...
- idea intellij 快捷键(ubuntu版本)
S + C + T 创建测试类 A + F12 开启终端 C + F12 查看类中的方法属性 ----随时更新,记录快捷方式
- keybd_event 转载
转自 http://apps.hi.baidu.com/share/detail/14468670 Option Explicit Private Declare Sub keybd_event Li ...
- jq 事件冒泡总结
什么是JS事件冒泡? 在一个对象上触发某类事件(比如单击onclick事件),如果此对象定义了此事件的处理程序,那么此事件就会调用这个处理程序,如果没有定义此事件处理程序或者事件返回true,那么这个 ...
- JQUERY1.9学习笔记 之基本过滤器(四) 首元素选择器
首元素选择器:jQuery( ":first" ) <!DOCTYPE html><html lang="zh-cn"><head ...
- IE兼容HTML5
<!--[if lt IE9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js" ...
- 关于Cococs中的CCActionEase(中)
相比之前的速度正弦变化动作(这个东西叫什么更好一些?渐变动画?)与速度指数级变化动作,CCEaseIn/CCEaseOut/CCEaseInOut更具灵活性.你可以设置运动的速率,甚至是在运动的过程中 ...
- Swift— Swift编码规范之命名规范-备
程序代码中到处都是自己定义的名字,取一个有样并且符合规范的名字非常重要. 命名方法很多,但是比较有名的,广泛接受命名法有: 匈牙利命名,一般只是命名变量,原则是:变量名=类型前缀+描述,如bFoo表示 ...
- 关于机器学习-EM算法新解
我希望自己能通俗地把它理解或者说明白,但是,EM这个问题感觉真的不太好用通俗的语言去说明白,因为它很简单,又很复杂.简单在于它的思想,简单在于其仅包含了两个步骤就能完成强大的功能,复杂在于它的数学推理 ...