#1108636 gpg-agent slows shutdown by 90 seconds

Package:
gpg-agent
Source:
gpg-agent
Description:
GNU privacy guard - cryptographic agent
Submitter:
Antoine Beaupre
Date:
2025-08-08 20:57:01 UTC
Severity:
normal
#1108636#5
Date:
2025-07-02 02:49:50 UTC
From:
To:
I'm not sure what's going on with the gpg-agent.service, but when i
reboot my computer, systemd hangs on it for 90 seconds (it "says"
1m30s anyways).

I can reproduce this in a session with `systemctl stop gpg-agent`
which hangs for about the same time.

In journald, we see this:

Jul 01 22:46:15 angela gpg-agent[5828]: scdaemon[5828]: DBG: SIGCONT received - breaking select
Jul 01 22:46:15 angela gpg-agent[5828]: scdaemon[5828]: SIGTERM received - shutting down ...
Jul 01 22:46:15 angela systemd[3858]: Stopping gpg-agent.service - GnuPG cryptographic agent and passphrase cache...
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: State 'stop-sigterm' timed out. Killing.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Killing process 5825 (gpg-agent) with signal SIGKILL.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Killing process 5828 (scdaemon) with signal SIGKILL.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Killing process 5829 (pipe-connection) with signal SIGKILL.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Killing process 5830 (gpg-agent) with signal SIGKILL.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Killing process 5833 (gpg-agent) with signal SIGKILL.
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Main process exited, code=killed, status=9/KILL
Jul 01 22:47:45 angela systemd[3858]: gpg-agent.service: Failed with result 'timeout'.
Jul 01 22:47:45 angela systemd[3858]: Stopped gpg-agent.service - GnuPG cryptographic agent and passphrase cache.


So on of two things:

 1. gpg-agent should respect TERM signals better and/or;
 2. the systemd unit should be less patient with it

a.

#1108636#10
Date:
2025-07-02 02:56:35 UTC
From:
To:
A few more details...

This is triggered only after I connect to a remove server with
gpg-agent's "ssh agent" mode, backed by a hardware token (a yubikey)
which holds my Authentication key. Merely starting the gpg-agent.service
unit is not enough.

Using the following override reduces the delay, in
~/.config/systemd/user/gpg-agent.service.d/override.conf:

[Service]
TimeoutStopSec=10s

A.

#1108636#15
Date:
2025-08-08 20:55:09 UTC
From:
To:
I attempted this workaround but it didn't work, the shutdown was still
just as slow.

However I discovered that after uninstalling the yubikey-touch-detector
package, the problem went away completely.