Broken keyring
For a while now, my evoluton has been slow when viewing pgp signed emails, which happens a lot on the mailing lists I frequent. There’s a distinct pause while the status line says that it’s verify the signature. I’ve generally just put it down to gpg and evo being slow, and to gpg auto-downloading the keys from the keyservers. Well, today, I got fed up, and did a bit of digging.
First test, go back and forth between a non-signed message, and a signed message. This eliminates any keyserver slowdowns, because the key should have been downloaded already. The pause was still there. Next, I decided to see if the key was somehow not being cached permanently. When I ran a command by hand, I got errors about a broken keyring and caching. Uh oh. So, I tried to rebuild the cache. Same errors. So, being a good geek, I googled for the errors which were these:
gpg: mpi larger than indicated length (2 bytes)
gpg: keyring_get_keyblock: read error: invalid packet
gpg: keyring_get_keyblock failed: invalid keyring
gpg: failed to rebuild keyring cache: invalid keyring
Nothing useful. Others have hit the problem but not found an anwer. Okay, I’ll google for dumping and rebuilding a keyring. Nothing. Okay, I’ll look through the man page. Hmmm… There’s an –export option. Sweet. Run gpg –export -o filename. Get error messages. Look at filename… doesn’t exist. Apparently, gpg deletes the filename on error. Okay, I can kindof buy that, it needs to be anal about security of keys. But, I need to dump. So, I run the stdout version, and redirect to a file. Success. Next, backup and delete the public keyring, and import the keys. Success! My gpg no longer gives broken keyring errors! And, evo is fast again, barely slower for signed messages than unsigned ones (assuming the key is already downloaded).
The moral of the story is: don’t just accept slowness in programs, there may be something easy you can do to fix it.
Sorry to disturb, but I got exactly the same problem on my gpg keyring.
Could you describe in more details what you did ? Although I’m myself somehow a geek, I’m not that expert with gpg and I would not like loosing all my keys…
Best regards
Bruce
gpg –export > keyring.dump
backup and delete original keyring
gpg –import keyring.dump