I have a problem similar to (but perhaps a little different from) this: Gpg.exe hangs sometimes
Installed Gpg4win 4.2.0 on Windows 2022 Server. We are using it to decrypt a file that a service provider generates daily. So we have a scheduled task that runs a PowerShell script that downloads this file and invokes gpg.exe to decrypt it. What we’re finding is that occasionally gpg.exe hangs. And unlike the problem I linked to above, it seems to ALWAYS hang after a reboot.
I suspect this has something to do with the fact that the file is not integrity protected. We cannot get our service provider to do this, unfortunately.
The script invokes gpg.exe with these parameters:
–ignore-mdc-error (to deal with the lack of integrity protection)
–pinentry-mode loopback
–batch
–passphrase <>
–output <>
–decrypt <>
What’s odd is that it appears to successfully decrypt the file, but gpg.exe is stuck–the script waits for the process to exit before proceeding, and it looks like it isn’t exiting. Or something.
To troubleshoot, the script now uses gpgconf.exe to stop both gpg-agent and keyboxd then wait 10 seconds and then launch both gpg-agent and keyboxd. The script waits 10 seconds after launching these to try decrypting with gpg.exe. Despite the pause, we sometimes see in the standard error output “gpg: waiting for lock C:\Users\username\AppData\Roaming\gnupg\gnupg_spawn_keyboxd_sentinel.lock…”
Regardless, what I’m really trying to figure out is why gpg.exe is stuck. Or, why it sometimes returns and sometimes does not. This is not an issue with other users on the system. There are no other users on the system, certainly not using any gpg executable.
On our old server, which was using Gpg4win 2.3.3, this didn’t happen. Also, on the old server, we used a gpg2.exe executable, but that does not appear to be available in Gpg4win 4.2.0. As you can guess, we set this up a long time ago, but I have a vague memory that gpg.exe in version 2.3.3 had some similar issues.
Thanks in advance.