Situation: I’m running mbsync every few minutes (configured using home-manager), which uses pass to retrieve the imap password. Pass needs to decrypt, so it depends on GnuPG
GPG and gpg-agent are also configured using home-manager
services.mbsync.enable = true;
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
defaultCacheTtl = 34560000;
maxCacheTtl = 34560000;
pinentryFlavor = "qt";
enableScDaemon = false;
};
despite the large cacheTtl values, a pinentry dialog shows up every few minutes, making working with my system unusable, as if there is no gpg-agent to cache the entry.
Output of journalctl --user show gpg-agent is restarted continuously, esp the lines:
gpg-agent[7939]: socket is now serviced by another server
gpg-agent[7939]: this process is useless - shutting down
gpg-agent[7939]: gpg-agent (GnuPG) 2.4.0 stopped
journalctl --user output
aug 12 13:45:11 laptop systemd[1816]: Starting mbsync mailbox synchronization…
aug 12 13:45:11 laptop systemd[1816]: Started GnuPG cryptographic agent and passphrase cache.
aug 12 13:45:11 laptop gpg-agent[7939]: gpg-agent[7939]: WARNING: “–supervised” is a deprecated option
aug 12 13:45:11 laptop gpg-agent[7939]: gpg-agent (GnuPG) 2.4.0 starting in supervised mode.
aug 12 13:45:11 laptop gpg-agent[7939]: using fd 3 for std socket (/run/user/10001/gnupg/S.gpg-agent)
aug 12 13:45:11 laptop gpg-agent[7939]: using fd 4 for ssh socket (/run/user/10001/gnupg/S.gpg-agent.ssh)
aug 12 13:45:11 laptop gpg-agent[7939]: listening on: std=3 extra=-1 browser=-1 ssh=4
aug 12 13:45:11 laptop gpg-agent[7941]: Loading the “qt_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:45:11 laptop gpg-agent[7941]: Loading the “qt_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:45:11 laptop gpg-agent[7941]: Loading the “qtbase_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:45:11 laptop gpg-agent[7941]: Failed to lookup password for key n/DA15C6C0060FE420647B68CBFE0C369B8456318A with secret service: The name org.freedesktop.secrets was not provided by any .service files
aug 12 13:45:11 laptop gpg-agent[7941]: Checking for Caps Lock not possible on unsupported platform: “xcb”
aug 12 13:45:19 laptop systemd[1816]: Finished mbsync mailbox synchronization.
aug 12 13:46:15 laptop gpg-agent[7939]: socket is now serviced by another server
aug 12 13:46:15 laptop gpg-agent[7939]: this process is useless - shutting down
aug 12 13:46:19 laptop gpg-agent[7939]: gpg-agent (GnuPG) 2.4.0 stopped
aug 12 13:50:11 laptop systemd[1816]: Starting mbsync mailbox synchronization…
aug 12 13:50:11 laptop systemd[1816]: Started GnuPG cryptographic agent and passphrase cache.
aug 12 13:50:11 laptop gpg-agent[8818]: gpg-agent[8818]: WARNING: “–supervised” is a deprecated option
aug 12 13:50:11 laptop gpg-agent[8818]: gpg-agent (GnuPG) 2.4.0 starting in supervised mode.
aug 12 13:50:11 laptop gpg-agent[8818]: using fd 3 for std socket (/run/user/10001/gnupg/S.gpg-agent)
aug 12 13:50:11 laptop gpg-agent[8818]: using fd 4 for ssh socket (/run/user/10001/gnupg/S.gpg-agent.ssh)
aug 12 13:50:11 laptop gpg-agent[8818]: listening on: std=3 extra=-1 browser=-1 ssh=4
aug 12 13:50:11 laptop gpg-agent[8821]: Loading the “qt_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:50:11 laptop gpg-agent[8821]: Loading the “qt_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:50:11 laptop gpg-agent[8821]: Loading the “qtbase_” catalog failed for locale QLocale(English, Latin, United States)
aug 12 13:50:11 laptop gpg-agent[8821]: Failed to lookup password for key n/DA15C6C0060FE420647B68CBFE0C369B8456318A with secret service: The name org.freedesktop.secrets was not provided by any .service files
aug 12 13:50:11 laptop gpg-agent[8821]: Checking for Caps Lock not possible on unsupported platform: “xcb”
aug 12 13:50:20 laptop systemd[1816]: Finished mbsync mailbox synchronization.
aug 12 13:51:15 laptop gpg-agent[8818]: socket is now serviced by another server
aug 12 13:51:15 laptop gpg-agent[8818]: this process is useless - shutting down
aug 12 13:51:19 laptop gpg-agent[8818]: gpg-agent (GnuPG) 2.4.0 stopped
aug 12 13:55:11 laptop systemd[1816]: Starting mbsync mailbox synchronization…
aug 12 13:55:11 laptop systemd[1816]: Started GnuPG cryptographic agent and passphrase cache.
aug 12 13:55:11 laptop gpg-agent[24539]: gpg-agent[24539]: WARNING: “–supervised” is a deprecated option
aug 12 13:55:11 laptop gpg-agent[24539]: gpg-agent (GnuPG) 2.4.0 starting in supervised mode.
aug 12 13:55:11 laptop gpg-agent[24539]: using fd 3 for std socket (/run/user/10001/gnupg/S.gpg-agent)
aug 12 13:55:11 laptop gpg-agent[24539]: using fd 4 for ssh socket (/run/user/10001/gnupg/S.gpg-agent.ssh)
aug 12 13:55:11 laptop gpg-agent[24539]: listening on: std=3 extra=-1 browser=-1 ssh=4
aug 12 13:55:21 laptop systemd[1816]: Finished mbsync mailbox synchronization.
aug 12 13:56:15 laptop gpg-agent[24539]: socket is now serviced by another server
aug 12 13:56:15 laptop gpg-agent[24539]: this process is useless - shutting down
aug 12 13:56:19 laptop gpg-agent[24539]: gpg-agent (GnuPG) 2.4.0 stopped
One thing I also noticed is that the sockets mentioned in the logs are different from the sockets mentioned when running gpgconf --list-dirs, e.g:
$ gpgconf --list-dirs agent-socket
/run/user/10001/gnupg/d.66ich9kpnhpcq9knttj8qqdj/S.gpg-agent
maybe it has to do something with it (or not)?
My setup is really simple, so I truly don’t know where to look for answers
UPDATE:
I did
$ cd /run/user/10001/gnupg/d.66ich9kpnhpcq9knttj8qqdj/
$ ln -s ../S.gpg-agent* .
and now gpg-agent does not kill itself anymore, so this looks like a temporary workaround.
So it is related to the the output of gpgconf --list-dirs being different from the sockets created by home-manager’s gpg config
The root cause is still unknown to me: bug in home-manager? bug in my own config somewhere?