dnf install/update fail with error rpmdbNextIterator skipping Header V3 RSA/SHA1 Signature BAD
Sometimes when an dnf update was unexpectedly terminated like a power failure, the system may leave an inconsistent rpm database. If this happens, in most case by rebuilding rpm database (rpmdb –rebuilddb), and to use (package-cleanup –cleandupes), it could be fixed.
For some severe case, after both, when you are trying to run (dnf update –allowerasing), it still shows this kind of errors:
Running transaction check
error: rpmdbNextIterator: skipping h# ***
Header V3 RSA/SHA1 Signature, key ID ********: BAD
Header SHA256 digest: OK
Header SHA1 digest: OK
And the install/update cannot go through.
If you use (rpm -qa | grep <affected-package>), it shows that the package is not installed. Reinstalling the package using (rpm -Uvh <downloaded package name>) does not help.
This means that a package was erased in the interrupted dnf install/update but the record was not removed from the rpm database. You will need to do
rpm -e –justdb –noscripts –nosignature <package name>
to remove it.
However, sometimes the blocking package name cannot be found in the rpm database.
Here is a clue: when you are doing dnf install, it spits off errors like
Error: transaction check vs depsolve:
libxxx.so.x()(64bit) is needed by <package name>
This shows what lib file is missing.
You can go to internet to google the rpm package of the libxxx.so.x to find which package for your linux distro provides the missing lib file. Then run the
rpm -e –justdb –noscripts –nosignature <package name>
to remove the missing package.
After this, the dnf should function properly thereafter.