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

Error: rpmdb open failed

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

How can I solve this?

  • This may happen also when running yum install as well. Thanks for this question Commented Jan 9, 2023 at 15:14

4 Answers 4


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
  • 1
    This solution seems to work with dnf instead of yum as well.
    – unhammer
    Commented Jan 18, 2016 at 14:30
  • I get "unfinished transactions remaining.." after doing all this, and the broken packages that created the problem continues to block any future installations. For that matter, why would the end-user need to see/do any of this? If the yum-db has an issue, it should clean/fix itself automatically - with at most a y/n prompt which an os-tinkerer might want to opt out of. Found the fix for my case - do the above, then do "yum-complete-transaction --cleanup-only"
    – JosephK
    Commented Mar 13, 2016 at 10:05
  • 12
    Why not just cd /var/lib/rpm; db_recover ? In most cases that's much less of a nuclear option. Commented Feb 24, 2017 at 8:06
  • 7
    I find sudo rpm --rebuilddb alone solves my case. Nevertheless always backup /var/lib/rpm for safe.
    – alick
    Commented Jun 12, 2017 at 21:44
  • For those who still see the killed message on yum install, just restart your server. Yes, it sucks to restart to get something basic like this working, but that was the only thing that worked for me.
    – Nirmal
    Commented Nov 15, 2017 at 6:44

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.


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*
  • 3
    Those should not be directories. If you see that, then you may want to run fsck on your partition to ensure you don't have file corruption.
    – docwhat
    Commented Jul 15, 2016 at 15:28

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
  • On running sudo /usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages I get the following error: rpmdb_load: DB->open: Packages: Permission denied
    – Arpit
    Commented Jul 22, 2021 at 10:27
  • It would be better if you raise a Question for this. Also mentioen which user are you trying to connect?
    – AReddy
    Commented Jul 24, 2021 at 6:56

You must log in to answer this question.

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