how-resolve-error-failchk-DB_RUNRECOVERY-Fatal-error-run-database-recovery

How to resolve error failchk DB_RUNRECOVERY Fatal error run database recovery

How to resolve error failchk DB_RUNRECOVERY Fatal error run database recovery

Now to resolve error failchk DB_RUNRECOVERY Fatal error run database recovery

When trying to install an application through yum [Yellowdog Updater, Modified] You may get an error message saying from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery

error message is shown below.

root@server [/home]# yum install appname
rpmdb: Thread/process 920761/140379164112640 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

What should we do now, its simple, You first try clearing the yum repository as below.

root@server [/home]# yum clean
rpmdb: Thread/process 920761/140379164112640 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

You were still shown the error message as above, You will need to rebuild the rpm database.

Try the command rpm –rebuilddb

root@server [/var/lib/rpm]# rpm --rebuilddb
rpmdb: Thread/process 920761/140379164112640 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)

You will get the error message as below.

Before rebuilding, we have to first remove the existing __db. files or move it somewhere.

change the director to /var/lib/rpm where the rpm details are stored.

root@server [/home]# cd /var/lib/rpm
root@server [/var/lib/rpm]# ll -h
total 94M
drwxr-xr-x.  2 root root 4.0K May  7 04:39 ./
drwxr-xr-x. 35 root root 4.0K Feb 23 22:54 ../
-rw-r--r--.  1 root root 5.4M May  8 04:52 Basenames
-rw-r--r--.  1 root root  12K May  7 06:13 Conflictname
-rw-r--r--   1 root root  24K May  8 10:57 __db.001
-rw-r--r--   1 root root 256K May  8 10:57 __db.002
-rw-r--r--   1 root root 1.3M May  8 10:57 __db.003
-rw-r--r--   1 root root 752K May  8 10:55 __db.004
-rw-r--r--.  1 root root 2.9M May  8 04:53 Dirnames
-rw-r--r--.  1 root root 9.9M May  8 04:53 Filedigests
-rw-r--r--.  1 root root  32K May  8 04:52 Group
-rw-r--r--.  1 root root  44K May  8 04:53 Installtid
-rw-r--r--.  1 root root 160K May  8 04:52 Name
-rw-r--r--.  1 root root  24K May  7 06:13 Obsoletename
-rw-r--r--.  1 root root  73M May  8 04:52 Packages
-rw-r--r--.  1 root root 2.6M May  8 04:53 Providename
-rw-r--r--.  1 root root 976K May  8 04:53 Provideversion
-rw-r--r--.  1 root root  12K Aug 21  2014 Pubkeys
-rw-r--r--.  1 root root 740K May  7 06:13 Requirename
-rw-r--r--.  1 root root 368K May  8 04:53 Requireversion
-rw-r--r--.  1 root root    0 Aug 19  2014 .rpm.lock
-rw-r--r--.  1 root root 340K May  8 04:53 Sha1header
-rw-r--r--.  1 root root 164K May  8 04:53 Sigmd5
-rw-r--r--.  1 root root  12K May  7 06:13 Triggername

You see on the above command result, __db.001, __db.003 and etc.. this are the files that needs to rebuilt.

Now for safetyI created a folder named ddb and moved the files to it.

root@server [/var/lib/rpm]# mkdir ddb
root@server [/var/lib/rpm]# mv _* ddb/

After moving the files,
Use the command rpm –rebuilddb

root@server [/var/lib/rpm]# rpm --rebuilddb

Before we start installing any packages, we need to clean the rpm repository

root@server [/var/lib/rpm]# yum clean all
Loaded plugins: fastestmirror, rhnplugin, security
Cleaning repos: base cl-mysql-meta cloudlinux-x86_64-server-6 extras updates
Cleaning up Everything
Cleaning up list of fastest mirrors

You can now able to install application using yum without any issues.

root@server [/var/lib/rpm]# yum install appname

That is all, this help you in resolving the yum db corrupt issue

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.