Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Corrupted rpm db - how to fix?

Hybrid View

  1. #1
    Join Date
    May 2015
    Location
    Italy
    Posts
    379

    Default Corrupted rpm db - how to fix?

    Hi everybody! Today I was investigating a problem that I have on my home pc since a few months.
    The problem is that zypper repeatedly asks me to confirm repository signing keys even if I already told it to trust the key always.

    I found a lot of threads with similar problems, which led me investigating zypper, gpg and rpm.At one point, I found out that my rpm db is corrupted, because when I enter 'rpm -qa gpg-pubkey*' this is what I get:

    Code:
    gpg-pubkey-accaf35c-57d58c01
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-6867f5be-4d77cecd
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-1abd1afb-54176598
    gpg-pubkey-c50a5d22-591463bb
    gpg-pubkey-accaf35c-57d58c01
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-8898875c-4c0241c4
    gpg-pubkey-efb20b23-5a4f4f57
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-11f63c51-3c7dc11d
    gpg-pubkey-c50a5d22-591463bb
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-be1229cf-5631588c
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-c50a5d22-591463bb
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d38b4796-570c8cd3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-83a736cf-514c2089
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-7fac5991-4615767f
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-c3401e12-587def4d
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-7f8840ce-4bb222d5
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-df7587c3-576a5c23
    error: rpmdbNextIterator: skipping h#   64697 
    Header V3 RSA/SHA256 Signature, key ID 3dbdc284: BAD
    Header SHA1 digest: BAD (Expected bf167126ecaa67d16fee74af17096529278aad8d != cd4a91ad1f0d65d360cce5dacffea553e358b550)
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-f191f0e8-58bafb92
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-3dbdc284-53674dd4
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-72db573c-4da468cb
    gpg-pubkey-f4752699-57163f23
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-accaf35c-57d58c01
    gpg-pubkey-efb20b23-5a4f4f57
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-d38b4796-570c8cd3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-accaf35c-57d58c01
    gpg-pubkey-0d988d6e-57839cae
    gpg-pubkey-0c1289c0-58c6ad7d
    gpg-pubkey-d4168679-59669fb3
    gpg-pubkey-df7587c3-576a5c23
    gpg-pubkey-ed340235-577f6c2e
    gpg-pubkey-df7587c3-576a5c23
    Besides the fact that there are a lot of duplicated entries (I don't know if it's normal), there is that ugly error that asks for immediate action.
    So I took a backup of the rpm db and then issued 'sudo rpm -vv --rebuilddb', which gave me this (snipped):

    Code:
    (...)
    Header SHA1 digest: OK
    D: adding "bison" to Name index.
    D: adding 53 entries to Basenames index.
    D: adding "Development/Languages/C and C++" to Group index.
    D: adding 17 entries to Requirename index.
    D: adding 2 entries to Providename index.
    D: adding 15 entries to Dirnames index.
    D: adding 1 entries to Installtid index.
    D: adding 1 entries to Sigmd5 index.
    D: adding "71bc5f24969fabf4a56f13f92b3c9f7968f2fe1c" to Sha1header index.
    D: adding 1 entries to Recommendname index.
    D:  read h#   64697
    Header SHA1 digest: BAD (Expected bf167126ecaa67d16fee74af17096529278aad8d != cd4a91ad1f0d65d360cce5dacffea553e358b550)
    error: cannot add record originally at 64697
    D: closed   db index       /usr/lib/sysimage/rpm/Packages
    D: closed   db environment /usr/lib/sysimage/rpm
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Packages
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Enhancename
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Supplementname
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Suggestname
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Recommendname
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Transfiletriggername
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Filetriggername
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Sha1header
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Sigmd5
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Installtid
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Dirnames
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Triggername
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Obsoletename
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Conflictname
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Providename
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Requirename
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Group
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Basenames
    D: closed   db index       /usr/lib/sysimage/rpmrebuilddb.21797/Name
    D: closed   db environment /usr/lib/sysimage/rpmrebuilddb.21797
    warning: failed to rebuild database: original database remains in place
    So, I don't know if this is the root cause of my problems with zypper, but it is nevertheless something that has to be dealt with.
    Given the fact that rpm itself hasn't been able to fix the situation, what possibilities do I have to fix the problem?

    Thank you in advance.
    Cris
    Desktop: OpenSUSE Tumbleweed (x86_64) - AMD FX-8350 Eight-Core Processor, 16Gb RAM, 120GB Samsung Evo 840 SSD
    Laptop: OpenSUSE Tumbleweed (x86_64) - Thinkpad T440 - Intel i5-4210U, 12Gb RAM, 250GB Samsung EVO 750 SSD

  2. #2
    Join Date
    May 2015
    Location
    Italy
    Posts
    379

    Default Re: Corrupted rpm db - how to fix?

    I tried dumping and reloading the Packages db by doing :
    Code:
    mv Packages Packages-BACKUP
    db_dump Packages-BAKUP | db_load Packages
    in /var/lib/rpm, but the new file (which is a bit smaller) still produces the error.
    Desktop: OpenSUSE Tumbleweed (x86_64) - AMD FX-8350 Eight-Core Processor, 16Gb RAM, 120GB Samsung Evo 840 SSD
    Laptop: OpenSUSE Tumbleweed (x86_64) - Thinkpad T440 - Intel i5-4210U, 12Gb RAM, 250GB Samsung EVO 750 SSD

  3. #3

    Default Re: Corrupted rpm db - how to fix?

    I would do that
    Start Yast> repository> gpg keys> find the error key delete it> restart Yast> should ask you whether to accept the new key.
    ------------------------------------
    Correct me if I'm wrong .
    ------------------------------------

  4. #4
    Join Date
    May 2015
    Location
    Italy
    Posts
    379

    Default Re: Corrupted rpm db - how to fix?

    Hi enziosavio!

    Quote Originally Posted by enziosavio View Post
    I would do that
    Start Yast> repository> gpg keys> find the error key delete it> restart Yast> should ask you whether to accept the new key.
    Thank you for your suggestion. Unfortunately Yast only shows me a handful of keys (6 IIRC, I'm not on the faulty box right now) and it shows no error.
    The same happens if I issue this at the cli:
    rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n'

    It will show just 5 or 6 keys with no error.

    I'm lost

    Anybody else has any idea of how to fix this, short of reinstalling?

    Thank you in advance
    Cris
    Desktop: OpenSUSE Tumbleweed (x86_64) - AMD FX-8350 Eight-Core Processor, 16Gb RAM, 120GB Samsung Evo 840 SSD
    Laptop: OpenSUSE Tumbleweed (x86_64) - Thinkpad T440 - Intel i5-4210U, 12Gb RAM, 250GB Samsung EVO 750 SSD

  5. #5

    Default Re: Corrupted rpm db - how to fix?



    Sorry but you have the fingerprint that gives you error, identify it between the keys and delete it, close and restart yast, which will ask you to accept the new Repo footprint
    ------------------------------------
    Correct me if I'm wrong .
    ------------------------------------

  6. #6

    Default Re: Corrupted rpm db - how to fix?

    id 3dbdc284

    you have the id and the key looks for matches
    ------------------------------------
    Correct me if I'm wrong .
    ------------------------------------

  7. #7

    Default Re: Corrupted rpm db - how to fix?

    Quote Originally Posted by Cris70 View Post
    Anybody else has any idea of how to fix this, short of reinstalling?
    You should be able to delete them with something like this:
    Code:
    rpm -e --allmatches gpg-pubkey-df7587c3-576a5c23
    But, do you actually have any problem because of the "duplicated" keys?
    If not, I see no reason to reinstall either...

    And I do have duplicates here on my system as well, although everything works fine AFAICT.

    If the rpm database is corrupted, you could try to run "rpm --rebuilddb" to hopefully fix it.
    "rpm --reinitdb" will create a new, empty, one that would also "fix" the duplicated keys, but it would also lose track of what packages are installed of course.

  8. #8

    Default Re: Corrupted rpm db - how to fix?

    Quote Originally Posted by wolfi323 View Post
    And I do have duplicates here on my system as well, although everything works fine AFAICT.
    PS: In my case the key for KDE:Extra is installed multiple (about 60+) times.
    That's probably related to the bug that caused libzypp to "forget" the repo key (triggered by PackageKit) and asking to accept it again and again. (which happened especially with that particular repo for me)

    I just had a look at libzypp's changelog (on Leap 42.3) and found this that sounds related:
    Code:
    * Tue Jan 16 2018 ma@suse.de
    - Fix deleted keys not removed from rpmdb too (bsc#1075449)
    - version 16.17.9 (0)
    I.e. apparently zypper/libzypp did not remove keys from the rpm database until recently due to a bug.
    Last edited by wolfi323; 20-Apr-2018 at 00:57.

  9. #9
    Join Date
    May 2015
    Location
    Italy
    Posts
    379

    Default Re: Corrupted rpm db - how to fix?

    Hi wolfi323!

    Quote Originally Posted by wolfi323 View Post
    PS: In my case the key for KDE:Extra is installed multiple (about 60+) times.
    That's probably related to the bug that caused libzypp to "forget" the repo key (triggered by PackageKit) and asking to accept it again and again. (which happened especially with that particular repo for me)
    Hey, this is exactly what is happening to me!!
    But, despite repeated googling I failed to find a related bug!! Do you have the number? Is it fixed now?
    The strange thing is that I only have it on one PC, the other one seems immune.

    Quote Originally Posted by wolfi323 View Post
    I just had a look at libzypp's changelog (on Leap 42.3) and found this that sounds related:
    Code:
    * Tue Jan 16 2018 ma@suse.de
    - Fix deleted keys not removed from rpmdb too (bsc#1075449)
    - version 16.17.9 (0)
    I.e. apparently zypper/libzypp did not remove keys from the rpm database until recently due to a bug.
    I am still seeing the problem, though. Had it just five minutes ago when I ran 'zypper dup'... I had to trust (again) the key for 4 repos.

    Cris
    Desktop: OpenSUSE Tumbleweed (x86_64) - AMD FX-8350 Eight-Core Processor, 16Gb RAM, 120GB Samsung Evo 840 SSD
    Laptop: OpenSUSE Tumbleweed (x86_64) - Thinkpad T440 - Intel i5-4210U, 12Gb RAM, 250GB Samsung EVO 750 SSD

  10. #10
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,371
    Blog Entries
    2

    Default Re: Corrupted rpm db - how to fix?

    Quote Originally Posted by Cris70 View Post
    Hi wolfi323!



    Hey, this is exactly what is happening to me!!
    But, despite repeated googling I failed to find a related bug!! Do you have the number? Is it fixed now?
    The strange thing is that I only have it on one PC, the other one seems immune.



    I am still seeing the problem, though. Had it just five minutes ago when I ran 'zypper dup'... I had to trust (again) the key for 4 repos.

    Cris
    You won't see the error fixed yet on your system, Wolfi said he found the issue possibly addressed on 42.3 and you're on TW.

    BTW -
    I found it curious that your rpm database is so complex with so many indexes...
    I checked on one of my own TW which is nearly a default install and it only has 2 indexes (Packages and Names) and 2 gpg-pubkeys(I haven't verified, but I'm guessing that means that more than one TW repo may be signed with the same pubkey).
    I guess your long list of indexes are due to your many OBS repos which possibly have packages under development with frequent changes...

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •