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
0 (0)
Article Rating (No 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
How to recover error - Audit error: dispatch err (pipe full) event lost
Viewed 3707 times since Tue, Aug 6, 2019
LVM: Extend SWAP size by adding a new Logical Volume
Viewed 640 times since Sat, Jun 2, 2018
Jak znaleźć najszybszy publiczny serwer DNS w Polsce?
Viewed 951 times since Mon, May 21, 2018
How do I add ethtool settings to a network device permanently?
Viewed 1555 times since Mon, May 21, 2018
How to sort IP addresses in Linux
Viewed 992 times since Sun, May 20, 2018
Jak ustawić LVM, jak robić snapshoty oraz automatycznie powiększać LV, czyli małe howto
Viewed 1297 times since Sun, May 20, 2018
LUKS List available methods of encryption for LUKS
Viewed 501 times since Fri, Jul 13, 2018
Linux - How to unlock and reset user’s account
Viewed 500 times since Fri, Jun 8, 2018
Manage Linux Password Expiration and Aging Using chage
Viewed 1162 times since Tue, Sep 11, 2018
systemd Auto-restart a crashed service in systemd
Viewed 307 times since Fri, Jan 17, 2020