The other day, I tried to update my Fedora 34 desktop system using sudo dnf --refresh upgrade
command and ended up with this issue - error: rpmdbNextIterator: skipping h# 3643 Header V4 RSA/SHA256 Signature, key ID 45719a39: BAD.
$ sudo dnf --refresh upgrade
Sample output:
[...] Running transaction check error: rpmdbNextIterator: skipping h# 3643 Header V4 RSA/SHA256 Signature, key ID 45719a39: BAD Header SHA256 digest: BAD (Expected cc14b51b22595cfdf9d87d21e6ab8604b62eb6481c4669fe814a9109754f4d54 != 00a7eb336286e45cec1ce6b67c4093fe6059bbe1ec95279f81dc51e2dc97ec89) Header SHA1 digest: BAD (Expected a5f792ecf06988120d3127a8b272471bf6927fca != 348ab5cbf958d0898e9ac2b69a5306a5fba7dbfd) The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. Error: An rpm exception occurred: package not installed
It was the first time I get such error and I wasn't sure about the root of the issue.
And also, I tried a few different commands:
$ sudo dnf update
$ sudo dnf --refresh update
$ sudo dnf --refresh dist-upgrade
Every time, I got the same error as shown above.
After a few web searches, I found a solution for this issue in Fedora forums.
Fix "error: rpmdbNextIterator: skipping" in Fedora
In order to fix rpmdbNextIterator
error, simply rebuild RPM database by executing the following command:
$ sudo rpm --rebuilddb
If you still encounter with the same error, run the above command one more time. You will not see any output if the problem is fixed.
And then update the Fedora system using command:
$ sudo dnf --refresh update
Sometimes, rebuilding RPM database doesn't help. In that case, you can backup and rebuild it again like below:
$ sudo mkdir /var/lib/rpm/old
$ sudo mv /var/lib/rpm/Pubkeys /var/lib/rpm/old/
Backup RPM database:
$ mv /var/lib/rpm/__db* /var/lib/rpm/old/
If you don't to backup RPM database, simply delete it.
$ sudo rm /var/lib/rpm/__db*
Now run the following command to rebuild RPM database:
$ sudo rpm --rebuilddb
If everything goes fine, you will not get any output.
And then update/upgrade Fedora system as usual.
$ sudo dnf update --refresh
In some cases, you will see permission denied error like below.
$ sudo rpmdb --rebuilddb -v
error: could not delete old database at /var/lib/rpmold.161084
Delete the above database manually using rm
command:
$ sudo rm -rf /var/lib/rpmold.rpmold.161084
Then, rebuild the RPM database:
$ sudo rpmdb --rebuilddb -v
Finally, update the Fedora system:
$ sudo dnf update --refresh
Sample output:
Fedora 34 - x86_64 19 kB/s | 6.4 kB 00:00 Fedora 34 openh264 (From Cisco) - x86_64 3.2 kB/s | 989 B 00:00 Fedora Modular 34 - x86_64 14 kB/s | 6.5 kB 00:00 Fedora 34 - x86_64 - Updates 12 kB/s | 5.6 kB 00:00 Fedora Modular 34 - x86_64 - Updates 22 kB/s | 6.5 kB 00:00 RPM Fusion for Fedora 34 - Free 4.9 kB/s | 7.1 kB 00:01 RPM Fusion for Fedora 34 - Free - Updates 6.9 kB/s | 6.5 kB 00:00 RPM Fusion for Fedora 34 - Free - Updates 45 kB/s | 337 kB 00:07 RPM Fusion for Fedora 34 - Nonfree 6.6 kB/s | 7.1 kB 00:01 RPM Fusion for Fedora 34 - Nonfree - Updates 7.7 kB/s | 7.1 kB 00:00 Dependencies resolved. [...]
Hope this helps.