Ошибка error rpmdb open failed

Поломался yum

29 Jul 2013 | Автор: dd |

Пытался тут на DOSимом серваке под CentOS доставить iftop для того чтобы отловить пакетики и забанить ботов, но вместо этого yum завис в одной консоли, так что пришлось открывать вторую и грохать процесс через kill.

После этого началась стабильная ругань на попытку установить любую приладу, а не только сканер:
root@241105 [~]# yum install iftop
rpmdb: Thread/process 5280/3086886592 failed: Thread died in Berkeley DB library
error: db3 error(-30974) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 —  (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed

Понятно, что надо чиниться, для чего выполняем следующие вещи:

запускаем указанную востоновлялку для базы
# db_recover -h /var/lib/rpm
и подчищаем кэши менеджера пакетов
# yum clean all
после чего пробуем снова и радуемся что все заработало.

Если не заработало, то поступаем более грубо, снеся все базы и перестроив их снова (процесс может растянутся на час-полтора):
# rm -f /var/lib/rpm/_db*
# rpm –rebuilddb
# yum clean all

Rating: 9.4/10 (12 votes cast)

Rating: +4 (from 4 votes)

Поломался yum, 9.4 out of 10 based on 12 ratings

Теги: centos

I’m trying to run yum update and I’m running this error:

rpmdb: PANIC: fatal region error detected; run recovery
error: db3 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:

Error: rpmdb open failed

I checked page like this one but running yum clean all runs the same error.

How can I solve this?

asked Apr 25, 2015 at 15:40

Ghasem's user avatar

1

This is how I fixed my problem.

You may fix this by cleaning out rpm database. But first, in order to minimize the risk, make sure you create a backup of files in /var/lib/rpm/ using cp command:

mkdir /root/backups.rpm.mm_dd_yyyy/
cp -avr /var/lib/rpm/ /root/backups.rpm.mm_dd_yyyy/

The try this to fix this problem:

# rm -f /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all

And finally verify that error has gone with the following yum command

# yum update

answered Apr 25, 2015 at 15:40

Ghasem's user avatar

GhasemGhasem

2,2893 gold badges15 silver badges19 bronze badges

7

All I had to do was to delete the two file with the «.lock» extension, and the three files that started with «__db».

# rm /var/lib/rpm/.dbenv.lock
# rm /var/lib/rpm/.rpm.lock
# rm /var/lib/rpm/__db*

After that, yum update worked.

answered Jan 17, 2019 at 19:00

isapir's user avatar

isapirisapir

4184 silver badges11 bronze badges

Thanks Alex, your answer worked for me apart from one slight change I had to make.

rm -f /var/lib/rpm/__db*

returned errors

rm: cannot remove `/var/lib/rpm/__db.001': Is a directory
rm: cannot remove `/var/lib/rpm/__db.002': Is a directory
rm: cannot remove `/var/lib/rpm/__db.004': Is a directory

so I had to recurse with

rm -rf /var/lib/rpm/__db*

answered Jun 6, 2015 at 20:18

Ian Ellis's user avatar

1

I tried the above one it did’nt work

below works fine

# cd /var/lib
# tar -zcvf /var/preserve/rpmdb-$(date +%Y-%m-%d_%H-%M-%S).tar.gz rpm

Note: This tar backup can be used if the attempt to recover the RPM database has issues.

Verify integrity of the Packages file:

# cd /var/lib/rpm
# rm -f __db*      # to avoid stale locks
# /usr/lib/rpm/rpmdb_verify Packages

# mv Packages Packages.orig
# /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages


# rpm -vv --rebuilddb

Once again verify RPM database:

# cd /var/lib/rpm
# /usr/lib/rpm/rpmdb_verify Packages

answered Apr 16, 2018 at 7:30

AReddy's user avatar

AReddyAReddy

3,1225 gold badges35 silver badges75 bronze badges

2

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

Is RedHat error “rpmdb open failed” giving you trouble?

At Bobcares, we offer solutions for every query, big and small, as a part of our Server Management Service.

Let’s take a look at how our Support Team recently helped a customer with the very common “rpmdb open failed” error.

What is RedHat error: “rpmdb open failed”?

The rpmdb open failed error often occurs when you attempt to update your system again after it was interrupted earlier. This is when you find yourself facing the following error message:

error: rpmdb: BDB0113 Thread/process 2196/139984719730496 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

We will also not be able to run the rpm query, resulting in the following error message:

[root@testvm~]# rpm -qa 
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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: rpmdb: BDB0113 Thread/process 7924/139979327153984 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 database in /var/lib/rpm 
[root@testvm ~]# rpm -Va 
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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: rpmdb: BDB0113 Thread/process 7924/139979327153984 failed: BDB1507 Thread died in Berkeley DB library e
rror: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
 error: cannot open Packages database in /var/lib/rpm 
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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 database in /var/lib/rpm 
[root@testvm~]#

The error is a result of a corrupt rmd or RPM database. Fortunately, our Support Team has come up with an easy resolution for this specific issue.

How to resolve RedHat error: “rpmdb open failed”

  1. First, we will create a backup directory where we can dump the rpmdb backup file as seen below:
    # mkdir /tmp/rpm_db_bak
  2. Then, we will back up the files in the newly created directory in the previous step in the /tmp folder.
    # mv /var/lib/rpm/__db* /tmp/rpm_db_bak
  3. Next, we have to rebuild the rpmdb by executing these commands:
    # rpm --rebuilddb -vv
    # rpmdb_verify Packages
  4. After that, we will clean the yum cache by running this command:
    # yum clean all
  5. Then, we will run the yum update command again in order to fetch and apply the updates from the repositories.

[Stuck with a different query? We are available 24/7.]

Conclusion

In brief, the skilled Support Engineers at Bobcares demonstrated how to resolve the “rpmdb open failed” error with ease.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

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:

error: rpmdb: BDB0113 Thread/process 2196/139984719730496 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

You are also not able to perform rpm query and getting same error message on screen:

[root@testvm~]# rpm -qa
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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: rpmdb: BDB0113 Thread/process 7924/139979327153984 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 database in /var/lib/rpm
[root@testvm ~]# rpm -Va
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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: rpmdb: BDB0113 Thread/process 7924/139979327153984 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 database in /var/lib/rpm
error: rpmdb: BDB0113 Thread/process 7924/139979327153984 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 database in /var/lib/rpm
[root@testvm~]#

The reason for this error is rpmdb or RPM Database has corrupted. No worry it is easy to recover the rpmdb by following below steps:

1. Create backup directory in which you need to dump the rpmdb backup.

# mkdir /tmp/rpm_db_bak

2. Backup the rpmdb files in created backup directory in /tmp

# mv /var/lib/rpm/__db* /tmp/rpm_db_bak

3. Now rebuild the rpmdb with below commands:

# rpm --rebuilddb -vv
# rpmdb_verify Packages

4. Clean the yum cache from below command:

# yum clean all

5. Now again run the yum update command. It should fetch and apply the updates from your or RHSM (or CentOS CDN in case of CentOS Linux) repositories:

[root@testvm ~]# yum update
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
epel/x86_64/metalink | 5.0 kB 00:00
epel | 4.3 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/7): base/7/x86_64/group_gz | 155 kB 00:02
(2/7): epel/x86_64/group_gz | 170 kB 00:04
(3/7): extras/7/x86_64/primary_db | 191 kB 00:12
(4/7): epel/x86_64/updateinfo | 809 kB 00:21
(5/7): base/7/x86_64/primary_db | 5.6 MB 00:26
(6/7): epel/x86_64/primary_db | 4.8 MB 00:46
(7/7): updates/7/x86_64/primary_db | 7.8 MB 00:50
Determining fastest mirrors
* base: mirror.ehost.vn
* epel: repo.ugm.ac.id
* extras: mirror.ehost.vn
* updates: mirror.dhakacom.com
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.4.0-19.el7_3 will be updated
---> Package NetworkManager.x86_64 1:1.4.0-20.el7_3 will be an update
---> Package NetworkManager-adsl.x86_64 1:1.4.0-19.el7_3 will be updated
[...]
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kernel x86_64 3.10.0-514.26.2.el7 updates 37 M
python2-libcomps x86_64 0.1.8-3.el7 epel 46 k
replacing python-libcomps.x86_64 0.1.6-13.el7
Updating:
NetworkManager x86_64 1:1.4.0-20.el7_3 updates 2.5 M
NetworkManager-adsl x86_64 1:1.4.0-20.el7_3 updates 146 k
NetworkManager-bluetooth x86_64 1:1.4.0-20.el7_3 updates 165 k
NetworkManager-glib x86_64 1:1.4.0-20.el7_3 updates 385 k
NetworkManager-libnm x86_64 1:1.4.0-20.el7_3 updates 443 k
NetworkManager-team x86_64 1:1.4.0-20.el7_3 updates 147 k
python-perf x86_64 3.10.0-514.26.2.el7 updates 4.0 M
sudo x86_64 1.8.6p7-23.el7_3 updates 735 k
systemd x86_64 219-30.el7_3.9 updates 5.2 M
systemd-libs x86_64 219-30.el7_3.9 updates 369 k
systemd-sysv x86_64 219-30.el7_3.9 updates 64 k
tuned noarch 2.7.1-3.el7_3.2 updates 210 k
xfsprogs x86_64 4.5.0-10.el7_3 updates 895 k
Removing:
kernel x86_64 3.10.0-123.el7 @anaconda 127 M

Transaction Summary
================================================================================
Install 2 Packages
Upgrade 46 Packages
Remove 1 Package

Total download size: 84 M
Is this ok [y/d/N]: y

Loading

  • Author
  • Recent Posts

Charanjit Cheema

Charanjit is working as a Linux Subject Matter Expert in Kyndryl, he has 16 Years of professional experience in IT Infrastructure Projects implementation and support service delivery. Rich work experience in Data Centers and MSCs (Mobile Switching Centers). He possesses good knowledge in Linux, VMware, AWS, and Openstack Cloud.
He is a lazy System Administrator who likes to Automate his task through Shell scripts and Ansible playbooks. He has contributed his many Automations work in Kyndryl and also maintain his own internal company Github repo.
His hobby is researching on new technologies and sharing this through his blog but if he is not researching or writing blog then you will find him listening music while sipping cup of coffee and enjoying the nature view.
You can find him on Twitter, Facebook, Linkedin or send him an email at webmaster@cjcheema.com

Charanjit Cheema

When using yum on CentOS, you might get something like Error: rpmdb open failed. A similar error like this can be shown:

yum clean all
error: rpmdb: BDB0113 Thread/process 2921108/140151702521664 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:

This means that your yum repository is corrupted. To fix this, we need to clean out the local yum database:

mv /var/lib/rpm/__db* /tmp
yum clean all

Now run the yum command again, e.g.:

yum update
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from CLN.
Determining fastest mirrors
[...]

If all goes well, remove the old database:

rm -rf /tmp/__db*

Понравилась статья? Поделить с друзьями:
  • Ошибка error request failed with status code 500
  • Ошибка error processing file битрикс
  • Ошибка error out of table range
  • Ошибка error opening file for writing
  • Ошибка error nod3ddevice