RPM databases usually get corrupted due to an interruption during the installation or updates.
Some of the common errors observed as a result of a corrupt RPM database are as follows:
error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db4 - (-30974) error: cannot open Packages database in /opt/freeware/packages error: rpmdb: Thread/process 32244334/1 failed: Thread died in Berkeley DB library error: db4 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db4 - (-30974) error: cannot open Packages database in /opt/freeware/packages
To resolve the error RPM DB_RUNRECOVERY error, Make sure rpm.rte is on the latest version.
if the updating version does not help to resolve the error, try the following steps:
change the directory to the RPM database directory with this command:
cd /opt/freeware
Then, create a backup as follows:
tar -chvf `date +"%d%m%Y"`.rpm.packages.tar packages
Next, remove the _db* lockfiles that are in use by the RPM with running this command:
rm -f /opt/freeware/packages/__*
After that, try to rebuild the database with the following command:
/usr/bin/rpm –rebuilddb
That’s all, Now we will test the rpm command again as given below:
/usr/bin/rpm -qa