Ok, was trying to update one of my servers today and encounter these funky error messages “error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery” while trying to update yum
1 2 3 4 5 6 7 8 | # sudo yum update [sudo] password for manager: rpmdb: Thread/process 19525/140269149038336 failed: Thread died in Berkeley DB library error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db3 - (-30974) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed |
Attempt to fix this with database recovery command somehow did not work
1 2 3 4 | # rpm --rebuilddb rpmdb: Thread/process 19525/140269149038336 failed: Thread died in Berkeley DB library error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db3 - (-30974) |
so proceed to check cd /var/lib/rpm and see what’s going on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # ls -l total 49248 -rw-r--r-- 1 root root 1548288 Jul 21 09:57 Basenames -rw-r--r-- 1 root root 12288 Jul 21 09:57 Conflictname -rw-r--r-- 1 root root 24576 Aug 7 18:07 __db.001 <----- files with __ are the lock files -rw-r--r-- 1 root root 229376 Aug 7 18:07 __db.002 -rw-r--r-- 1 root root 1318912 Aug 7 18:07 __db.003 -rw-r--r-- 1 root root 753664 Aug 2 11:30 __db.004 -rw-r--r-- 1 root root 802816 Jul 21 09:57 Dirnames -rw-r--r-- 1 root root 2605056 Jul 21 09:57 Filedigests -rw-r--r-- 1 root root 12288 Jul 21 09:57 Group -rw-r--r-- 1 root root 8192 Jul 21 09:57 Installtid -rw-r--r-- 1 root root 24576 Jul 21 09:57 Name -rw-r--r-- 1 root root 12288 Jul 21 09:57 Obsoletename -rw-r--r-- 1 root root 40312832 Jul 21 09:57 Packages -rw-r--r-- 1 root root 2576384 Jul 21 09:57 Providename -rw-r--r-- 1 root root 1486848 Jul 21 09:57 Provideversion -rw-r--r-- 1 root root 12288 Jul 5 2013 Pubkeys -rw-r--r-- 1 root root 196608 Jul 21 09:57 Requirename -rw-r--r-- 1 root root 90112 Jul 21 09:57 Requireversion -rw-r--r-- 1 root root 45056 Jul 21 09:57 Sha1header -rw-r--r-- 1 root root 24576 Jul 21 09:57 Sigmd5 -rw-r--r-- 1 root root 12288 Jul 21 09:57 Triggername |
remove the unwanted files with rm -f __* command
and bingo !
1 2 3 4 5 6 | # yum update Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/metalink | 14 kB 00:00 base: mirrors.loosefoot.com epel: mirrors.kernel.org |
Hope this tutorial can be useful for those having problem with yum update.