Oracle Linux logo

Oracle Linux 7: rpmdb open failed

While installation of oracle database 12c release 1 on oracle Linux 7, I tried installation of below mentioned packages as a part of oracle database installation pre-requisite but getting failed with the message “Another app is currently holding the yum lock;”.

[root@localhost ~]# yum install binutils* compat-libstdc++* gcc* gcc-c++* glibc* glibc.i686* glibc-devel* ksh* libgcc* libstdc++* libstdc++-devel* libaio* libaio-devel* libXext* libXtst* libX11* libXau* libxcb * libXi* make* sysstat* unixODBC* unixODBC-devel* zlib-devel* -y
Loaded plugins: langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 2386.
Another app is currently holding the yum lock; waiting for it to exit...
 The other application is: PackageKit
 Memory : 63 M RSS (464 MB VSZ)
 Started: Fri Nov 28 06:31:22 2014 - 12:00 ago
 State : Running, pid: 2386
Another app is currently holding the yum lock; waiting for it to exit...
 The other application is: PackageKit
 Memory : 63 M RSS (463 MB VSZ)
 Started: Fri Nov 28 06:31:22 2014 - 12:02 ago
 State : Uninterruptible, pid: 2386

After waiting sufficient amount of time, I decided to kill precess id. ( i.e. 2386 )

[root@localhost ~]# kill -9 2386

Process ID successfully killed but again mentioned packages installation failed with new Error: rpmdb open failed.

[root@localhost ~]# yum install binutils* compat-libstdc++* gcc* gcc-c++* glibc* glibc.i686* glibc-devel* ksh* libgcc* libstdc++* libstdc++-devel* libaio* libaio-devel* libXext* libXtst* libX11* libXau* libxcb * libXi* make* sysstat* unixODBC* unixODBC-devel* zlib-devel* -y
error: rpmdb: BDB0113 Thread/process 2386/139857582520128 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
CRITICAL:yum.main:
Error: rpmdb open failed

Root Cause:

I have issued wrong command at wrong time, I have forcefully killed/aborted/failed active package installation process with process id: 2386, resulting: RPM database corrupted.
Solution is simple, just need to delete and rebuild RPM database.

Solution:
Issue the following command as a root user:

Confirm that your RPM database corrupted with following RPM command, It will prompt you same error message mentioned above.

[root@localhost ~]# rpm -qa | sort

On safer side, backup your RPM database before rebuild it:

[root@localhost ~]# cp -r /var/lib/rpm /var/tmp/rpm-backup

Following remove command will help you to remove the RPM lock files:

[root@localhost ~]# rm -fr /var/lib/rpm/__db*

Rebuild RPM database with following RPM command:

[root@localhost ~]# rpm -vv --rebuilddb

Kindly confirm that your RPM database rebuild successfully with following:

[root@localhost ~]# rpm -qa | sort

Clean your yum:

[root@localhost ~]# yum clean all
Loaded plugins: langpacks
Cleaning repos: ol7_UEKR3 ol7_latest
Cleaning up everything

After following all above steps, yum have been installed all packages smoothly.

Stay Tune. 🙂