How can I fix this corrupted rpmdb?

2.2k Views Asked by At

My rpmdb is corrupted, and the usual procedure for fixing it doesn't seem to work.

This is the error:

cris@PolariSuse [~]$ rpm -qa > /dev/null
error: rpmdbNextIterator: skipping h#   64697
Header V3 RSA/SHA256 Signature, key ID 3dbdc284: BAD
Header SHA1 digest: BAD (Expected bf167126ecaa67d16fee74af17096529278aad8d != cd4a91ad1f0d65d360cce5dacffea553e358b550)

If I try to fix it I get this:

cris@PolariSuse [~]$ sudo rpmdb --rebuilddb
[sudo] password for root:
error: cannot add record originally at 64697
warning: failed to rebuild database: original database remains in place

I even tried db_dump against the Packages file and subsequent db_load: it apparently works but the newly produced Packages file has the same error.

However, I see that after rpm gets the error while listing packages, it is nonetheless able to continue listing the subsequent packages, so ideally I would like to rebuild the Packages file skipping the corrupted record. Unfortunately I have not found any utility capable of doing it.

Does anybody know another way of fixing this corrupted db?

1

There are 1 best solutions below

14
Jeff Johnson On

Remove the header and reinstall.

See the rpm man page for how to erase given a header # (the 64697 in the message you posted).

You may need --nosignature --nodigest to disable the checks that are failing