This is an important public service announcement for Fedora 24, 25 and 26 (pre-release) users, courtesy of the Fedora QA team.

The short version

If you recently updated and got some kind of error or crash, and now you’re getting RPM database errors, try this command to fix it (you can use sudo for root privileges):

sudo rpm --rebuilddb

If that’s not enough, try:

sudo rm -f /var/lib/rpm/__db*
sudo rpm --rebuilddb

Now all should be well again. We do apologize for this. Note that if you’re unlucky and have the updates-testing repository enabled, there’s a chance you may run into issues with more than one update: the same recovery steps should work each time.

The longer version

There’s a rather subtle and tricky bug in libdb (the database that RPM uses) which has been causing problems with upgrades from Fedora 24/25 to Fedora 26. The developers have made a few attempts to fix this, and testing this week had indicated that the most recent attempt — libdb-5.3.28-21 — was working well. We believed the fix needed to be applied both on the ‘from’ and the ‘to’ end of any affected transaction, so we went ahead and sent the -21 update out to Fedora 24, 25 and 26.

Unfortunately it turns out that updating to -21 along with other packages can possibly result in a crash at the very end of the process, which in turn causes a (as it happens, minor and fully recoverable) problem in the RPM database.

We initially sent a -22 update to updates-testing which reverts the changes from -21, but then found out that updating from -21 to -22 causes a similar result. At that point we decided it was probably best just to cut our losses, stick with -21, and document the issues for anyone who encountered them, and we have removed the -22 update from updates-testing again. There will be a -23 build soon which restores the fixes from -21 and adds another upgrade-related fix.

So if you’re affected by RPM database issues with any libdb update, just doing the old “rebuild the RPM database” trick will resolve the problem:

sudo rm -f /var/lib/rpm/__db*
sudo rpm --rebuilddb

And if you did wind up in -22, you may want to go back to -21. To do this, run the following command:

sudo dnf --refresh distro-sync

Note that you may need to do the rebuilddb step after downgrading from -22 to -21, or after upgrading from -22 to -23 when -23 arrives.

It’s unfortunate that we have to break that one out of cold storage, but it should at least get you back up and working for now. We do apologize sincerely for this mess, and we’ll try and do all we can to fix it up ASAP.