≡ Menu

CentOS: rpmdb: PANIC: fatal region error detected; run recovery error and solution

I am using a CentOS Linux v6.5 on my home server and I am getting the following error when I execute yum command:

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

How do I fix this problem on a CentOS / RHEL based system?

This is quite the messy situation. You may fix this by cleaning out rpm database. To minimize risk, make 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/

To find list of __db* file, enter:
# ls -l /var/lib/rpm/_*
Sample outputs:

-rw-r--r-- 1 root root   24576 Jan 28 04:00 /var/lib/rpm/__db.001
-rw-r--r-- 1 root root  229376 Jan 28 04:00 /var/lib/rpm/__db.002
-rw-r--r-- 1 root root 1318912 Jan 28 04:00 /var/lib/rpm/__db.003
-rw-r--r-- 1 root root  753664 Jan 28 04:00 /var/lib/rpm/__db.004

To fix this problem, try:
# rm -f /var/lib/rpm/__db*
# db_verify /var/lib/rpm/Packages
# rpm --rebuilddb
# yum clean all

Verify that error has gone with the following yum command
# yum update
Sample outputs:

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 12 comments… add one }
  • danfalos May 28, 2014, 2:05 pm

    Thanks alot for this information.Thanks again.

  • Cihan June 29, 2014, 2:28 am

    That was very helpful and made me solve the problem in minutes. Thanks!

  • Dave July 28, 2014, 10:44 am

    Well written article and very helpful. Thank you – Resolved my problem.

  • Jackson August 24, 2014, 10:24 pm

    Thanks for this. I had a power outage during an update that caused some corruption. Solved my issue.

  • Raz October 10, 2014, 12:04 am

    Very helpful.
    Thanks a lot

  • Vijay January 22, 2015, 10:09 am

    Awesome solution….i was stuck in this issue for past 3 days….the above steps resolved my issue….thanks man!!!

  • Robert Morley May 19, 2015, 6:21 am

    Thank you! As someone who only has linux installed for one specific purpose and has nearly no understanding of it beyond that, this gave me exactly what I needed.

  • Aleksey Tsalolikhin July 1, 2015, 3:08 pm

    Thank you for having consistently excellent and useful content!!

  • virtual July 13, 2015, 3:32 pm

    Never written comments. However, in earnest I have learned a lot Linux and UNIX from cyberciti.biz, specifically your NixCraft site. With guys like Vivek Gite you can’t go wrong.

    Great and trusted work buddies – is all I can say.


  • Turrican August 21, 2015, 6:18 am

    This solved my rpm database problem after a filesystem crash on a SLES machine, thank you very much!

    Under SLES, if you have zypper installed instead of yum, you need to run “zypper clean” instead of “yum clean all”.

    Thanks again!

  • Helio Paixao January 18, 2016, 11:50 am

    Thanks for sharing.

    Helio Paixao

  • Mike Solomon March 23, 2016, 10:43 am

    Thanks for that

    Fixed my problem :)

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: