Kleopatra & "gpg -K" hang

Hello, as of yesterday I was unable to git commit, I pinned down the issue to GPG problems - Kleopatra UI “hangs” with “loading cache” message and shows no certificates, also “gpg -K” hangs (does nothing at all, forever).
I have tried googling, but I have no idea what I am supposed to do now. Tried reinstalling gpg4win with the newest version, restarting the pc, etc.

Version 3.1.8-gpg4win-3.1.10

gpg --version
gpg (GnuPG) 2.2.17
libgcrypt 1.8.4

Thank you for your kind help.


We have currently no known issue that could be causing this, except that you might have a very large key in your keyring that is probably spammed and would take extremely much time.

Can you try a “gpg --check-trustdb” please. If that also hangs try a “gpg --verbose --check-trustdb”

Also there might be a somehow broken lock file in your gnupg home directory. You can look there and check.

Somehow broken could for example happen if you had run gpg from an elevated user and it did not remove the lock file when terminating. So it might no longer have the permission to take the lock as a normal user.

Interesting. The commands you suggest run okay:
λ gpg --verbose --check-trustdb
gpg: using pgp trust model
gpg: 2 keys processed (2 validity counts cleared)
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 1 signed: 0 trust: 1-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2021-04-11

Though the gpg -K still hangs.

deleting the *.lock files was the first thing that i tried, in fact.
the problem still persists. Well I could simply delete the whole folder if that helped, the keys have no actual value, I can always generate new ones.

Or maybe my registry got screwed? is there a way to clean it and everything & start over anew ?

thank you!

That trustdb check output also rules out that signature spam on a key could be an issue.

Please do not delete it. Worst case move it away, you might need it later or we might need it later for further analysis :wink:

Could you please go into:

Kleopatra → Settings → Configure Kleopatra → GnuPG System → Private Keys

Then in “Options useful for debugging” set the level to 4 - all and select a log file below that. Then kill the gpg-agent. Do a gpg -K. And save the log file (afterwards you can set the debuging level back to zero.

If you could attach that log here or send it to me at aheinecke@gnupg.org it would be much appreciated. Maybe it helps us to understand and fix your problem. Such a hang always needs to be fixed.

I am unable to get any output to the logfile.

I set the level and the logfile in the config, but nothing gets written to it when I run gpg -Kv, it hangs and that’s all.

I was unable to find any “gpg-agent” in the process list though - might that suggest anything?

on the other hand, i found out two processes that start up after i start Kleopatra: GNU PG’s OpenGPG tool (32 bit) and GNU PG’s x.509/cms tool (32 bit)
when I kill both, the two of my keys appear and the "loading cache " ceases to show immediatelly. Anyway, after clicking the menu, i am unable to “export the secret keys”, as the option is grayed out. This was previously accessible, i am sure. This whole issue happened the next day I exported the key generated here and imported the one that i generated on an another PC (new notebook). this is ilustrated in the attaached screenshots.

does it help in any way?

Screenshots.zip (96.1 KB)

Hello again.

I have just wanted to revisit this issue, so I tried Kleopatra and gpg -Kv again … and somehow they both work! The issue resolved itself miraculously… I have no idea what is going on.

Anyway … thanks for help.