Yum Update: DB_RUNRECOVERY Fatal error, run database recovery

Yum Update: DB_RUNRECOVERY Fatal error, run database recovery

Image of Mattias Geniar

Mattias Geniar, April 26, 2016

Follow me on Twitter as @mattiasgeniar

If for some reason your server’s disk I/O fails during a yum or RPM manipulation, you can see the following error whenever you run yum or rpc:

# yum update
...
rpmdb: page 18816: illegal page type or format
rpmdb: PANIC: Invalid argument
rpmdb: Packages: pgin failed for page 18816
error: db4 error(-30974) from dbcursor->c_get: DB_RUNRECOVERY: Fatal error, run database recovery
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30974) from dbcursor->c_close: DB_RUNRECOVERY: Fatal error, run database recovery
No Packages marked for Update
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30974) from db->close: DB_RUNRECOVERY: Fatal error, run database recovery
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30974) from db->close: DB_RUNRECOVERY: Fatal error, run database recovery
rpmdb: File handles still open at environment close
rpmdb: Open file handle: /var/lib/rpm/Packages
rpmdb: Open file handle: /var/lib/rpm/Name
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30974) from dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery

The fix is, thankfully, rather easy: remove the RPM database, rebuild it and let yum download all the mirror’s file lists.

$ mv /var/lib/rpm/__db* /tmp/
$ rpm --rebuilddb
$ yum clean all

The commands above are safe to run. If for some reason this does not fix, you can get the files back from the /tmp path where they were moved.

Solution:

Please follow these steps to backup and rebuild the rpmdb database:

mkdir /var/lib/rpm/backup
cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
rm -f /var/lib/rpm/__db.[0-9][0-9]*
rpm --quiet -qa
rpm --rebuilddb
yum clean all
5 (1)
Article Rating (1 Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Linux: how to monitor the nofile limit
Viewed 10752 times since Wed, Jul 25, 2018
chrt command: Set / Manipulate Real Time Attributes of a Linux Process
Viewed 11177 times since Mon, Feb 17, 2020
Przekazywanie portów TCP rinetd
Viewed 43736 times since Thu, May 24, 2018
Tcpdump Examples Linux
Viewed 5964 times since Fri, Nov 16, 2018
Open SSL Creating Certificate Signing Request — CSR Generation
Viewed 1977 times since Mon, Feb 18, 2019
How to convert RAW image to VDI and otherwise
Viewed 15113 times since Wed, Oct 3, 2018
How to use yum-cron to automatically update RHEL/CentOS Linux 6.x / 7.x
Viewed 5149 times since Tue, Dec 4, 2018
RHEL: udev rules basics
Viewed 8948 times since Sat, Jun 2, 2018
How To: Linux Hard Disk Encryption With LUKS [ cryptsetup Command ]
Viewed 7404 times since Fri, Jul 13, 2018
An easier way to manage disk decryption at boot with Red Hat Enterprise Linux 7.5 using NBDE
Viewed 7675 times since Mon, Aug 6, 2018