Поломался 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
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
Alex JoligAlex Jolig
2,2193 gold badges14 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
isapirisapir
3983 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
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
AReddyAReddy
3,0545 gold badges34 silver badges70 bronze badges
2
Today, I was testing Nginx web server in a CentOS 7 VM. Unfortunately, the power has gone in the middle of the update process. Since I don’t have a UPS, my host system went down immediately. After few minutes, the power came, and I turned on the VM again and started the upgrade process. When I run the «yum update» command, I got this 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
It seemes like YUM broke down. I couldn’t run any yum command. I haven’t faced this error before, and I didn’t know what to do. So, I headed over to the CentOS forum hoping to find a suitable solution to fix this issue. After a few searches over the forum, luckily I found a workaround. If you ever got into this problem, look nowhere and just do the following steps.
First backup the rpm database using command as root user:
# mv /var/lib/rpm/__db* /tmp
Then, run the following command:
# yum clean all
Now, run the update again:
# yum update Loaded plugins: fastestmirror Cleaning repos: base epel extras updates Cleaning up everything Cleaning up list of fastest mirrors [root@server ~]# 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
I type y to continue the update. Voila! Everything is worked as expected.
Finally, I cleaned the backup using command:
# rm -i /tmp/__db*
And, that’s all for now. Hope this helps.
Related read:
- [Solved] — «error: rpmdbNextIterator: skipping» In Fedora Linux
25 comments
k3p3
September 11, 2018 — 9:06 am
Thank You.. It works
Reply
vicky
August 16, 2022 — 9:59 pm
rm -f /var/lib/rpm/__db*
db_verify /var/lib/rpm/Packages
rpm –rebuilddb
yum clean all
Reply
Marcos
September 16, 2018 — 10:18 pm
Thank You!!!
Reply
blah
September 21, 2018 — 11:40 am
thanks!
Reply
Nikhil Madhwani
October 5, 2018 — 2:56 am
Thank you!!!
Reply
Rob
November 2, 2018 — 8:58 am
Thanks, first link I look into and it worked!
Reply
tomaski
December 7, 2018 — 4:04 am
yeah, it does help, but in my case the issue just keeps returning… ¯_(ツ)_/¯
Reply
James
February 16, 2019 — 3:47 am
Praise you!
Reply
sk
February 16, 2019 — 12:22 pm
My pleasure.
Reply
robustrockster
July 24, 2019 — 4:18 pm
thanks it worked for me.
thanks indeed
Reply
sk
July 24, 2019 — 6:24 pm
You’re welcome. Glad it helped.
Reply
nabor
September 16, 2019 — 3:02 am
It works like charm! Thank you!
Reply
icycle
September 27, 2019 — 4:16 am
There’s another, simpler, solution that works for me:
rpm –rebuilddb
Reply
Yann
December 6, 2019 — 4:20 pm
Thank you !!!!!!!!!!!!
Reply
Tanaji
February 17, 2020 — 10:55 am
Thank you. Was able to resolve the issue.
Reply
Aitor
February 24, 2020 — 4:22 pm
Thank you, it worked on centos with directadmin.
Reply
Xd
March 20, 2020 — 11:32 am
Cool! Thank you
Reply
Muhammad Hafid
March 27, 2020 — 7:10 am
Thanks my problem solved
Reply
Ingram Braun
June 7, 2020 — 11:57 am
Works like a charm! Thank you!
Reply
maub_dash
July 9, 2020 — 7:53 pm
Thanks!
Reply
PK
January 3, 2021 — 9:37 am
Trying this with DNF now. It does NOT work. “DNF update” cannot even connect to some servers, and basic commands like sudo are missing. What’s happening?
Reply
MarkAnthony
January 7, 2021 — 4:56 pm
rpm –rebuilddb was fast and worked for me.
seems wise though to make note of both methods described here
thanks for this discussion
Reply
Saadedin
June 2, 2021 — 8:06 am
Works like a charm! Thank you!
Reply
DevOps
September 23, 2021 — 6:36 pm
Thank you, it working for me
Reply
Danny Lopez
September 21, 2022 — 7:58 pm
thanks, it Work
Reply
Leave a Comment
This site uses Akismet to reduce spam. Learn how your comment data is processed.
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”
- First, we will create a backup directory where we can dump the rpmdb backup file as seen below:
# mkdir /tmp/rpm_db_bak
- 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
- Next, we have to rebuild the rpmdb by executing these commands:
# rpm --rebuilddb -vv # rpmdb_verify Packages
- After that, we will clean the yum cache by running this command:
# yum clean all
- 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
941 views / 0 like / April 12, 2020/April 12, 2020/
In this article, we will see how to resolve unable to update CentOS server error rpmdb open failed issue.
Are you getting an error while updating packages on CentOS server? This article will guide you to solve the issue.
Error logs similar to below log that we encountered:
error: db5 error(11) from dbenv->open: Resource temporarily unavailable
error: cannot open Packages index using db5 – Resource temporarily unavailable (11)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:Error: rpmdb open failed
To resolve it follow these steps:
1. Access the server using SSH with root user
2. Stash all the headers files on which yum uses for dependency resolution
# yum clean headers
3. Clean yum packages cache
# yum clean packages
4. Clean metadata
# yum clean metadata
5. Clean dbcache
# yum clean dbcache
6. Clean remaining things
# yum clean all
7. Remove clean all RPM database files
# rm -f /var/lib/rpm/__db.*
8. Rebuilt RPM Database
# rpm -vv –rebuilddb
9. Now run the update command
# yum update
If it doesn’t solve the issue, HostnExtra’s server management plan will help you.
[Need assistance to fix this error or install tools? We’ll help you.]
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
54,121 total views, 26 views today
- Author
- Recent Posts
Charanjit is working as a Linux Subject Matter Expert in Kyndryl, he has 15 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 onTwitter, Facebook, Linkedin or send him an email at webmaster@cjcheema.com
Bug 523140
— CRITICAL:yum.main: Error: rpmdb open failed
Summary:
CRITICAL:yum.main: Error: rpmdb open failed
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|