{"id":7812,"date":"2019-05-03T16:50:56","date_gmt":"2019-05-03T08:50:56","guid":{"rendered":"http:\/\/rmohan.com\/?p=7812"},"modified":"2019-05-03T16:50:58","modified_gmt":"2019-05-03T08:50:58","slug":"how-to-recover-rpmdb-open-failed-error-in-rhel-or-centos-linux","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7812","title":{"rendered":"How to recover \u201crpmdb open failed\u201d error in RHEL or Centos Linux"},"content":{"rendered":"\n<p>You are updating the system through yum command and suddenly power goes down or what happen if yum process is accidentally killed. Post this situation when you tried to update the system again with yum command now you are getting below error message related to rpmdb:<\/p>\n\n\n\n<p>error: rpmdb: BDB0113 Thread\/process 2196\/139984719730496 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages index using db5 &#8211; (-30973)<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br>\nCRITICAL:yum.main:<\/p>\n\n\n\n<p>Error: rpmdb open failed<br>\nYou are also not able to perform rpm query and getting same error message on screen:<\/p>\n\n\n<p>[root@testvm~]<\/p>\n\n\n\n<p># rpm -qa<br>\nerror: rpmdb: BDB0113 Thread\/process 7924\/139979327153984 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages index using db5 &#8211; (-30973)<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br>\nerror: rpmdb: BDB0113 Thread\/process 7924\/139979327153984 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br><\/p>\n\n\n<p>[root@testvm ~]<\/p>\n\n\n\n<p># rpm -Va<br>\nerror: rpmdb: BDB0113 Thread\/process 7924\/139979327153984 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages index using db5 &#8211; (-30973)<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br>\nerror: rpmdb: BDB0113 Thread\/process 7924\/139979327153984 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br>\nerror: rpmdb: BDB0113 Thread\/process 7924\/139979327153984 failed: BDB1507 Thread died in Berkeley DB library<br>\nerror: db5 error(-30973) from dbenv-&gt;failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery<br>\nerror: cannot open Packages database in \/var\/lib\/rpm<br><\/p>\n\n\n<p>[root@testvm~]<\/p>\n\n\n\n<p>#<br>\nThe reason for this error is rpmdb has corrupted. No worry it is easy to recover the rpmdb by following below steps:\n<\/p>\n\n\n\n<ol><li>Create backup directory in which you need to dump the rpmdb backup.<\/li><\/ol>\n\n\n\n<p>mkdir \/tmp\/rpm_db_bak<\/p>\n\n\n\n<ol><li>Backup the rpmdb files in created backup directory in \/tmp<\/li><\/ol>\n\n\n\n<p>mv \/var\/lib\/rpm\/__db* \/tmp\/rpm_db_bak<\/p>\n\n\n\n<ol><li>Clean the yum cache from below command:<\/li><\/ol>\n\n\n\n<p>yum clean all<\/p>\n\n\n\n<ol><li>Now again run the yum update command. It will rebuilt the rpmdb and should fetch and apply the updates from your repository or RHSM (or CentOS CDN in case of CentOS Linux)<\/li><\/ol>\n\n\n<p>[root@testvm ~]<\/p>\n\n\n\n<p># yum update<br>\nLoaded plugins: fastestmirror<br>\nbase | 3.6 kB 00:00<br>\nepel\/x86_64\/metalink | 5.0 kB 00:00<br>\nepel | 4.3 kB 00:00<br>\nextras | 3.4 kB 00:00<br>\nupdates | 3.4 kB 00:00<br>\n(1\/7): base\/7\/x86_64\/group_gz | 155 kB 00:02<br>\n(2\/7): epel\/x86_64\/group_gz | 170 kB 00:04<br>\n(3\/7): extras\/7\/x86_64\/primary_db | 191 kB 00:12<br>\n(4\/7): epel\/x86_64\/updateinfo | 809 kB 00:21<br>\n(5\/7): base\/7\/x86_64\/primary_db | 5.6 MB 00:26<br>\n(6\/7): epel\/x86_64\/primary_db | 4.8 MB 00:46<br>\n(7\/7): updates\/7\/x86_64\/primary_db | 7.8 MB 00:50<br>\nDetermining fastest mirrors\n<\/p>\n\n\n\n<ul><li>base: mirror.ehost.vn<\/li><li>epel: repo.ugm.ac.id<\/li><li>extras: mirror.ehost.vn<\/li><li>updates: mirror.dhakacom.com<br>\nResolving Dependencies<br>\n&#8211;&gt; Running transaction check<br>\n&#8212;&gt; Package NetworkManager.x86_64 1:1.4.0-19.el7_3 will be updated<br>\n&#8212;&gt; Package NetworkManager.x86_64 1:1.4.0-20.el7_3 will be an update<br>\n&#8212;&gt; Package NetworkManager-adsl.x86_64 1:1.4.0-19.el7_3 will be updated<br>\n[\u2026]<br>\n&#8211;&gt; Finished Dependency Resolution<\/li><\/ul>\n\n\n\n<p>Dependencies Resolved<\/p>\n\n\n\n<p>================================================================================<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Package Arch Version Repository Size<\/h1>\n\n\n\n<p>Installing:<br>\nkernel x86_64 3.10.0-514.26.2.el7 updates 37 M<br>\npython2-libcomps x86_64 0.1.8-3.el7 epel 46 k<br>\nreplacing python-libcomps.x86_64 0.1.6-13.el7<br>\nUpdating:<br>\nNetworkManager x86_64 1:1.4.0-20.el7_3 updates 2.5 M<br>\nNetworkManager-adsl x86_64 1:1.4.0-20.el7_3 updates 146 k<br>\nNetworkManager-bluetooth x86_64 1:1.4.0-20.el7_3 updates 165 k<br>\nNetworkManager-glib x86_64 1:1.4.0-20.el7_3 updates 385 k<br>\nNetworkManager-libnm x86_64 1:1.4.0-20.el7_3 updates 443 k<br>\nNetworkManager-team x86_64 1:1.4.0-20.el7_3 updates 147 k<br>\npython-perf x86_64 3.10.0-514.26.2.el7 updates 4.0 M<br>\nsudo x86_64 1.8.6p7-23.el7_3 updates 735 k<br>\nsystemd x86_64 219-30.el7_3.9 updates 5.2 M<br>\nsystemd-libs x86_64 219-30.el7_3.9 updates 369 k<br>\nsystemd-sysv x86_64 219-30.el7_3.9 updates 64 k<br>\ntuned noarch 2.7.1-3.el7_3.2 updates 210 k<br>\nxfsprogs x86_64 4.5.0-10.el7_3 updates 895 k<br>\nRemoving:<br>\nkernel x86_64 3.10.0-123.el7 @anaconda 127 M<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Transaction Summary<\/h1>\n\n\n\n<p>Install 2 Packages<br>\nUpgrade 46 Packages<br>\nRemove 1 Package<\/p>\n\n\n\n<p>Total download size: 84 M<br>\nIs this ok [y\/d\/N]: y<\/p>\n","protected":false},"excerpt":{"rendered":"\n<p>You are updating the system through yum command and suddenly power goes down or what happen if yum process is accidentally killed. Post this situation when you tried to update the system again with yum command now you are getting below error message related to rpmdb:<\/p>\n<p>error: rpmdb: BDB0113 Thread\/process 2196\/139984719730496 failed: BDB1507 Thread [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7812"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7812"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7812\/revisions"}],"predecessor-version":[{"id":7813,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7812\/revisions\/7813"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}