Invalid packet/keyring. How to find out what's responsible?

Kevin Gallagher kevin at
Wed Oct 19 18:45:42 CEST 2016

I've been seeing this error lately both with one of my local GPG
keyrings, and with apt.

    gpg: [don't know]: invalid packet (ctb=2d)
    gpg: keydb_get_keyblock failed: Value not found
    gpg: [don't know]: invalid packet (ctb=2d)
    gpg: /tmp/tmp.rObzKgJEj5/pubring.gpg: copy to
    '/tmp/tmp.rObzKgJEj5/pubring.gpg.tmp' failed: Invalid packet
    gpg: error writing keyring '/tmp/tmp.rObzKgJEj5/pubring.gpg':
    Invalid packet
    gpg: [don't know]: invalid packet (ctb=2d)
    gpg: error reading '-': Invalid packet
    gpg: import from '-' failed: Invalid packet

In the latter case, I solved it by exporting all my keys and importing
them back again. But that doesn't work this time:

apt-key exportall says: gpg: key export failed: Invalid keyring

How can I figure out which specific key is corrupted or responsible for
this, so I can repair my keyring?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20161019/d4c0042d/attachment.html>

More information about the Gnupg-users mailing list