GPG produces no output

I’ve been using gpg (from GPG4Win, on Windows of course) on this particular machine for months to sign git commits. One day, I noticed that committing never worked. I investigated a bit, and found that using gpg is unsuccessful.

I scoured the 'net and found that a good baseline test is to run gpg -K to list secret keys - and running gpg -K, I get no output whatsoever. The application starts, and just sits there - cursor blinking, no output, the application doesn’t exit, absolutely nothing happens.

I tried running gpg -K -v to get some more logging information and I only get an output of:

gpg: enabled compatibility flags:
gpg: using pgp trust model

How can I investigate further? I’ve already tried reinstalling GPG4Win and this did not help the situation. I’ve seen a couple posts around the internet with a similar issues, but they largely pertain to Linux - though I’ve tried following their recommendations as well. I’ve checked permissions on my %appdata%/gnupg folder, as well as my secret keys in that folder. Same with my windows home folder - ~/.gnupg - I also have full control here.

On the command line try gpgconf --show-configs and maybe paste the output here.

Something that could cause this is a bad software which also installs gnupg and sets a registry key to change the homedir to its preferred place. This happened in the past. Also you might try to run:

gpg --homedir c:\Users\Yourusername\Appdata\Roaming\gnupg -K

I am not sure what you mean by “~/.gnupg” on Windows. If you have changed the homedir location to this then maybe the setting of that change is the problem? In my command example that is the default homedir.

Here’s the output of gpgconf --show-configs:

Dump of all standard config files

GnuPG 2.4.0 (c0556edb8)

MingW32

[VERSION file not found]

Windows 10.0 build 19045

Libgcrypt 1.10.1

GpgRT 1.46

Codepages: 65001 1252 437

sysconfdir:C%3a\ProgramData\GNU\etc\gnupg
bindir:C%3a\Program Files (x86)\GnuPG\bin
libexecdir:C%3a\Program Files (x86)\GnuPG\bin
libdir:C%3a\Program Files (x86)\GnuPG\lib\gnupg
datadir:C%3a\Program Files (x86)\GnuPG\share\gnupg
localedir:C%3a\Program Files (x86)\GnuPG\share\locale
socketdir:C%3a\Users\nathan.ell\AppData\Local\gnupg
dirmngr-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.dirmngr
keyboxd-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.keyboxd
agent-ssh-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.gpg-agent.ssh
agent-extra-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.gpg-agent.extra
agent-browser-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.gpg-agent.browser
agent-socket:C%3a\Users\nathan.ell\AppData\Local\gnupg\S.gpg-agent
homedir:C%3a\Users\nathan.ell\AppData\Roaming\gnupg

global config “C:\ProgramData\GNU\etc\gnupg\common.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\common.conf”: not installed

global config “C:\ProgramData\GNU\etc\gnupg\gpg-agent.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\gpg-agent.conf”: not installed

global config “C:\ProgramData\GNU\etc\gnupg\scdaemon.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\scdaemon.conf”: not installed

global config “C:\ProgramData\GNU\etc\gnupg\dirmngr.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\dirmngr.conf”: not installed

global config “C:\ProgramData\GNU\etc\gnupg\gpg.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\gpg.conf”: not installed

global config “C:\ProgramData\GNU\etc\gnupg\gpgsm.conf”: not installed

local config “C:\Users\nathan.ell\AppData\Roaming\gnupg\gpgsm.conf”: not installed

Registry entries:

GnuPG Desktop related:

HKLM\Software\Gpg4win:Install Directory

->C:\Program Files (x86)\Gpg4win<-

Outlook related:

\Software\Microsoft\Office\Outlook\Addins\GNU.GpgOL:LoadBehavior

->2<-

\Software\GNU\GpgOL related:

logFile=C:\Users\nathan.ell\gpgol.txt

enableDebug=0

searchSmimeServers=0

enableSmime=0

preferSmime=0

encryptDefault=0

signDefault=0

inlinePGP=0

replyCrypt=1

autoresolve=1

automation=1

autosecure=1

autotrust=0

autoencryptUntrusted=0

autoimport=0

I tried running gpg --homedir C:\Users\username\AppData\Roaming\gnupg -K and got the same behaviour - no output, application doesn’t exit.

When I mention ~/.gnupg I just meant C:\Users\username.gnupg is all. Permissions are full control there. I haven’t changed a homedir at all (not even sure how I’d do that, and I see from gpgconf --show-configs that it’s as you mentioned)

Hi Nathan,
another possibility to further analyse the situation is to add another “-v”,
like “gpg -vv -K”.

Does “gpg -vv -k” run as it should, btw?

If -K does not work, are you using some personal firewall applications, that may block the connection to gpg-agent?

Next you could try “gpg -vv --debug-all -K”, but do not post the contents here, but see what you can learn.

Best,
Bernhard

When I mention ~/.gnupg I just meant C:\Users\username.gnupg is all. Permissions are full control there. I haven’t changed a homedir at all (not even sure how I’d do that, and I see from gpgconf --show-configs that it’s as you mentioned)

So your Keys are in C:\Users\username.gnupg ? That would explain it, because GnuPG looks in C:\Users\Username\AppData\Roaming\gnupg .

Try running the command with --homedir C:\Users\username.gnupg and / or copy the contents of C:\Users\username.gnupg to C:\Users\Username\AppData\Roaming\gnupg

~/.gnupg is only the homedir on Linux.

When I run gpg -vv -K, I get three lines of output - “enabled compatibility flags:”, “using pgp trust model”, and “key : accepted as trusted key”

When I run with --debug-all, the last two lines seem to be a bit interesting:

iobuf-1.0: underflow: buffer size: 2314; still buffered: 0 => space for 2314 bytes
iobuf-1.0: close ‘?’

I don’t know what this means, but it doesn’t quite seem right. I don’t have any sort of firewall that should be blocking anything. I did, however, check task manager and I didn’t see gpg-agent running - so I tried launching it with gpgconf --launch gpg-agent, which also had the same behaviour of just sitting there with no output and not exiting, and also did not change the behaviour of gpg -K

@Andre, to be clear, I do indeed have my secret keys in the default location (AppData). I only mention C:\Users\username.gnupg because the folder happened to exist on my system. If I try running with --homedir C:\users\username.gnupg the application DOES actually exit, but with no output