Saturday, October 16, 2021

[Solved] DB_RUNRECOVERY: Fatal error, run database recovery


The issue occurs when trying to install the java-1.8.0-openjjdk-devel on the Centos8 EC2 Instance in the AWS.

 # yum install java-1.8.0-openjdk-devel -y
So this command took some time to run during which phase i thought it was struck and press the control+c to stop it.

When i try to run again it showed that there was pid running. 

So i killed the pid and when i tried to install again I got the following error.

error: rpmdb: BDB0113 Thread/process 3446/140301746613120 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm
Error: Error: rpmdb open failed


The error occured because when you run the command some changes were made in the rpmdb which got exited forcefully before the clean up cloud have occured due to which the rpmdb got corrupted. Once the Rpm db is corrupted you wont be able to use the yum or rpm to install packages. You need to recreate the rpmdb and install the changes again to fix the issue.


To recover this error you will have to recreate the rpm database by using the following commands which help you recover from the error above. So please follow the steps below to backup and rebuild the rpmdb database

mkdir /var/lib/rpm/backup
cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
rm -f /var/lib/rpm/__db.[0-9][0-9]*
rpm --quiet -qa
rpm --rebuilddb
yum clean all


Post a Comment