After upgrading gnupg2 to 2.1, the gpg-agent stopped exporting GPG_AGENT_INFO variable. Therefore gpg (version 1.4.19) cannot finf the agent anymore and reports an error: $ "gpg-agent" "--disable-scdaemon" "--allow-preset" "--daemon" $ /usr/libexec/gpg-preset-passphrase -P passphrase --preset 8E136E6F34C0D4CD941A9DB749539D60EFEA4EAD $ "gpg" "--batch" "--no-tty" "--armor" "--default-key" "49539D60EFEA4EAD" "--use-agent" "--detach-sign" test_file gpg: gpg-agent is not available in this session [...] Adding proper --gpg-agent-info argument allows the gpg to work again. Installed packages: # rpm -qf /usr/bin/gpg /usr/bin/gpg-agent gnupg-1.4.19-1.fc23.x86_64 gnupg2-2.1.3-1.fc23.x86_64 This is because of this code from g10/passphrase.c: if (opt.gpg_agent_info) infostr = xstrdup (opt.gpg_agent_info); else { infostr = getenv ( "GPG_AGENT_INFO" ); if (!infostr || !*infostr) { if (!try) { #ifdef ENABLE_NLS if (orig_codeset) bind_textdomain_codeset (PACKAGE, orig_codeset); #endif /*ENABLE_NLS*/ log_info (_("gpg-agent is not available in this session\n")); opt.use_agent = 0; } return NULL; } infostr = xstrdup ( infostr ); } Obviously, gpg requires GPG_AGENT_INFO environment variable or --gpg-agent-info argument. I propose to add a fallback to "${GNUPGHOME}/S.gpg-agent::1" value which is now hard-coded by all gnupg-2 tools.
Please submit this suggestion upstream using the gpg bugtracker - https://bugs.g10code.com/gnupg/index
Reported as <https://bugs.gnupg.org/gnupg/issue1986>.
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle. Changing version to '23'. (As we did not run this process for some time, it could affect also pre-Fedora 23 development cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.) More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Recently upgraded Fedora 22 to Fedora 23 and this is now a problem. The gpg-agent provided by the GNOME desktop is no longer available to `gpg` on the command line, or tools like vim-gnupg etc. That's distressing. Can we (re)export the GPG_AGENT_INFO environment variable as a workaround? AfC
(In reply to Andrew Cowie from comment #4) > Recently upgraded Fedora 22 to Fedora 23 and this is now a problem. The > gpg-agent provided by the GNOME desktop is no longer available to `gpg` on > the command line, or tools like vim-gnupg etc. That's distressing. Can we > (re)export the GPG_AGENT_INFO environment variable as a workaround? You can do that in your ~/.bashrc, I'm not going to add workarounds that aren't in upstream gpg 1.4 I'm doing the following in mine: function gpg-update() { GPG_PID=$(pidof gpg-agent) GPG_AGENT_INFO=${HOME}/.gnupg/S.gpg-agent:$GPG_PID:1 export GPG_AGENT_INFO } gpg-update
(In reply to Brian Lane from comment #5) > GPG_PID=$(pidof gpg-agent) Ok, fair enough, but there hasn't been a `gpg-agent` running on a GNOME desktop for a long while now. And GPG is ignoring GPG_AGENT_INFO now, it seems? AfC
No, it works just fine, I use gpg --use-agent with it all the time.