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 perform I/O performance test with dd command
Viewed 6623 times since Fri, Jun 8, 2018
linux ssh How to Hide the OpenSSH Version Details when Telnet to Port 22
Viewed 6349 times since Wed, Apr 22, 2020
LVM: Move allocated PE between Physical Volumes
Viewed 4524 times since Sat, Jun 2, 2018
how to list all hard disks in linux from command line
Viewed 4460 times since Mon, Jan 28, 2019
RHCS6: Extend an existing Logical Volume / GFS2 filesystem
Viewed 3824 times since Sun, Jun 3, 2018
Transform XML to CSV Format | Unix String Pattern Manipulation The Ugly Way
Viewed 6844 times since Sun, Jan 9, 2022
Epoch & Unix Timestamp Conversion Tools
Viewed 70317 times since Fri, Jun 22, 2018
How to clear swap memory in Linux
Viewed 2621 times since Mon, Nov 23, 2020
Learn Linux System Auditing with Auditd Tool on CentOS/RHEL
Viewed 5063 times since Fri, Apr 5, 2019
RHEL: Reinstalling Boot Loader on the Master Boot Record (MBR)
Viewed 4054 times since Sun, May 27, 2018