How to Solve Error Message error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery when running yum command

Posted on

Introduction

Another article in order for solving the error message exist in the title of the article. The error message appear upon the execution of ‘yum’ command. It is actually the execution of supervisor tool using ‘yum’ command. So, it is actually has a relation with another article exist in this link. It is an article with the title of ‘How to Install supervisord in Linux CentOS 7’. Before going on to the solution part, this introduction part will going to have another detail parts. Those parts are the error appearance part and the error trigger part.

Error Appearance

So, where does the error message actually appear ?. Basically, it appears in the process for installing ‘supervisor’ tool using ‘yum’ command. The following is the actual process on installing ‘supervisor’ using ‘yum’ where it actually stuck as in the following execution :

[root@localhost ~]# yum -y install supervisor
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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
[1]+ Killed yum -y install supervisord
[root@localhost ~]# yum -y install supervisor
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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@localhost ~]#

Error Trigger

What is the actual reason or the cause triggering the error message ?. Well, actually it is because of the previous execution of ‘yum -y install supervisord’. The previous execution is terminated in the middle of the process by typing ‘Ctrl + Z’. Moreover, after stopping the command execution by force, there is another step which killed the process entirely. The following is the execution of the command where it will trigger the error message as it exist in the previous part :

[root@localhost ~]# yum -y install supervisord
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* epel: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* extras: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
* updates: xxxxxx.xxxxxxxxxxxxxxxxxx.xxx.xxx
No package supervisord available.

^C^C^C^C^Z
[1]+ Stopped yum -y install supervisord
[root@localhost ~]# yum -y install supervisor
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 2020.
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (367 MB VSZ)
Started: Thu Nov 25 16:22:20 2021 - 00:20 ago
State : Traced/Stopped, pid: 2020
Another app is currently holding the yum lock; waiting for it to exit...
The other application is: yum
Memory : 43 M RSS (367 MB VSZ)
Started: Thu Nov 25 16:22:20 2021 - 00:22 ago
State : Traced/Stopped, pid: 2020
^C

Exiting on user cancel.
[root@localhost ~]# ps -aux | grep yum
root 2020 1.5 1.1 376292 44156 pts/0 T 16:22 0:00 /usr/bin/python /bin/yum -y install supervisord
root 2023 0.0 0.0 112808 976 pts/0 S+ 16:22 0:00 grep --color=auto yum
[root@localhost ~]# kill -9 2020

Solution

So, what is the actual solution for solving the problem ?.  There are several articles available in the internet regarding on the solution. One of them which is becoming the reference for solving the solution in this article exist in this link. It is an article with the title of ‘Fix rpmdb: Thread died in Berkeley DB library’. So, the following is an attempt for trying to list the yum repository :

[root@localhost ~]# yum repolist
error: rpmdb: BDB0113 Thread/process 2020/140598702356288 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@localhost ~]#

As in the output of the above command execution appear, it gives a simple error message which is hinting that there is something wrong with the ‘rpmdb’. In that case, the solution available in the link reference is worth to try. The following is the execution in sequence to solve the problem :

[root@localhost ~]# ps aux | grep yum
root 2030 0.0 0.0 112808 976 pts/0 R+ 16:23 0:00 grep --color=auto yum
[root@localhost ~]# mkdir /var/lib/rpm/backup
[root@localhost ~]# cp -a /var/lib/rpm__db* /var/lib/rpm/backup/
cp: cannot stat ‘/var/lib/rpm__db*’: No such file or directory
[root@localhost ~]# cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
[root@localhost ~]# rm -f /var/lib/rpm/__db.[0-9][0-9]*
[root@localhost ~]# rpm --quiet -qa
[root@localhost ~]# rpm --rebuilddb
[root@localhost ~]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base docker-ce-stable epel extras pgdg-common pgdg10 pgdg11 pgdg12 pgdg13 pgdg14 pgdg96 updates
Cleaning up list of fastest mirrors
[root@localhost ~]#

Finally, just execute the yum command once more. The following is an example using the installation of ‘supervisor’ tool with the following detail execution :

[root@localhost ~]# yum -y install supervisor
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                                 | 7.9 kB  00:00:00
 * base: xxxxxxx.xxxxx.xxx.xx
 * epel: xxxxxxx.xxxxxxxxxxxxxxx.xxx.xx
 * extras: xxxxxxx.xxxxxxx.xxx.xx
 * updates: xxxxxxx.xxxxx.xxxxx
base                                                                                                                                                 | 3.6 kB  00:00:00
docker-ce-stable                                                                                                                                     | 3.5 kB  00:00:00
epel                                                                                                                                                 | 4.7 kB  00:00:00
extras                                                                                                                                               | 2.9 kB  00:00:00
pgdg-common/7/x86_64/signature                                                                                                                       |  198 B  00:00:00
pgdg-common/7/x86_64/signature                                                                                                                       | 2.9 kB  00:00:00 !!!
pgdg10/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg10/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg11/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg11/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg12/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg12/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg13/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg13/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg14/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg14/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
pgdg96/7/x86_64/signature                                                                                                                            |  198 B  00:00:00
pgdg96/7/x86_64/signature                                                                                                                            | 3.6 kB  00:00:00 !!!
updates                                                                                                                                              | 2.9 kB  00:00:00
(1/22): base/7/x86_64/group_gz                                                                                                                       | 153 kB  00:00:00
(2/22): docker-ce-stable/7/x86_64/primary_db                                                                                                         |  69 kB  00:00:00
(3/22): docker-ce-stable/7/x86_64/updateinfo                                                                                                         |   55 B  00:00:00
(4/22): epel/x86_64/group_gz                                                                                                                         |  96 kB  00:00:00
(5/22): epel/x86_64/updateinfo                                                                                                                       | 1.0 MB  00:00:00
(6/22): extras/7/x86_64/primary_db                                                                                                                   | 243 kB  00:00:00
(7/22): pgdg10/7/x86_64/group_gz                                                                                                                     |  245 B  00:00:01
(8/22): base/7/x86_64/primary_db                                                                                                                     | 6.1 MB  00:00:01
(9/22): pgdg11/7/x86_64/group_gz                                                                                                                     |  245 B  00:00:00
(10/22): pgdg12/7/x86_64/group_gz                                                                                                                    |  245 B  00:00:00
(11/22): pgdg-common/7/x86_64/primary_db                                                                                                             | 147 kB  00:00:01
(12/22): pgdg13/7/x86_64/group_gz                                                                                                                    |  246 B  00:00:00
(13/22): pgdg10/7/x86_64/primary_db                                                                                                                  | 355 kB  00:00:01
(14/22): pgdg13/7/x86_64/primary_db                                                                                                                  | 155 kB  00:00:00
(15/22): pgdg14/7/x86_64/group_gz                                                                                                                    |  244 B  00:00:00
(16/22): pgdg12/7/x86_64/primary_db                                                                                                                  | 240 kB  00:00:00
(17/22): pgdg14/7/x86_64/primary_db                                                                                                                  |  72 kB  00:00:00
(18/22): pgdg96/7/x86_64/group_gz                                                                                                                    |  249 B  00:00:00
(19/22): pgdg11/7/x86_64/primary_db                                                                                                                  | 380 kB  00:00:01
(20/22): pgdg96/7/x86_64/primary_db                                                                                                                  | 341 kB  00:00:00
(21/22): epel/x86_64/primary_db                                                                                                                      | 7.0 MB  00:00:03
(22/22): updates/7/x86_64/primary_db                                                                                                                 |  12 MB  00:00:02
Resolving Dependencies
--> Running transaction check
---> Package supervisor.noarch 0:3.4.0-1.el7 will be installed
--> Processing Dependency: python-meld3 >= 0.6.5 for package: supervisor-3.4.0-1.el7.noarch
--> Running transaction check
---> Package python-meld3.x86_64 0:0.6.10-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================
 Package                                     Arch                                  Version                                        Repository                           Size
============================================================================================================================================================================
Installing:
 supervisor                                  noarch                                3.4.0-1.el7                                    epel                                498 k
Installing for dependencies:
 python-meld3                                x86_64                                0.6.10-1.el7                                   epel                                 73 k

Transaction Summary
============================================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 571 k
Installed size: 2.9 M
Downloading packages:
(1/2): python-meld3-0.6.10-1.el7.x86_64.rpm                                                                                                          |  73 kB  00:00:00
(2/2): supervisor-3.4.0-1.el7.noarch.rpm                                                                                                             | 498 kB  00:00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                       1.5 MB/s | 571 kB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-meld3-0.6.10-1.el7.x86_64                                                                                                                         1/2
  Installing : supervisor-3.4.0-1.el7.noarch                                                                                                                            2/2
  Verifying  : python-meld3-0.6.10-1.el7.x86_64                                                                                                                         1/2
  Verifying  : supervisor-3.4.0-1.el7.noarch                                                                                                                            2/2

Installed:
  supervisor.noarch 0:3.4.0-1.el7

Dependency Installed:
  python-meld3.x86_64 0:0.6.10-1.el7

Complete!
[root@localhost ~]#

Leave a Reply