gpg-agent stopped working
I have been successfully using the gnupg21
package from MacPorts for several months. Within the past few days I updated my MacPorts installation (sudo port -d selfupdate
) and then made sure I was up to date (sudo port upgrade outdated
). Since then gpgv2
no longer works:
tartarus:~ sbooth$ gpg2 -K
gpg: can't connect to the agent: IPC connect call failed
tartarus:~ sbooth$ gpg-connect-agent
gpg-connect-agent: no running gpg-agent - starting '/opt/local/bin/gpg-agent'
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: waiting for the agent to come up ... (4s)
gpg-connect-agent: waiting for the agent to come up ... (3s)
gpg-connect-agent: waiting for the agent to come up ... (2s)
gpg-connect-agent: waiting for the agent to come up ... (1s)
gpg-connect-agent: can't connect to the agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running
tartarus:~ sbooth$ gpg-agent --help
Assertion failed: (res == 0), function enter_npth, file npth.c, line 123.
Abort trap: 6
I have completely uninstalled my MacPorts installation (rm -rf /opt/local
) and reinstalled everything, to no avail. Is there something else I can try?
I'm running macOS Sierra 10.12.1 (16B2657).
I'm seeing exactly the same problem and, according to a MacPorts bug report, it's coming from libgpg-error
and not seen with GnuPG version 2.1.16.
So it seems we need to either wait for the gnupg21
port to move from 2.1.15 to 2.1.16 or locally modify and rebuild the gnupg21
port (and maybe some of its dependencies?) to upgrade ahead of the official update. I'm not sure I'd want to do the latter with something like GnuPG though, although that's just an instinctive reaction.
Workaround
Rather than upgrading gnupg21
I've found that downgrading libgpg-error
makes the problem go away (I tried this because of the comment in the GnuPG mailing list post linked from the bug report that it's the upgrade of libgpg-error
from 1.24 to 1.25 that's caused the problem).
MacPorts provides guidance on downgrading a port and on one of my Macs I still happened to have 1.24 available (I installed MacPorts without root privileges hence the omission of sudo
here):
$ port installed inactive | grep libgpg
libgpg-error @1.24
$ port activate libgpg-error @1.24
---> Computing dependencies for libgpg-error
---> Deactivating libgpg-error @1.25_0
---> Cleaning libgpg-error
---> Activating libgpg-error @1.24_0
---> Cleaning libgpg-error
$ port installed inactive | grep libgpg
libgpg-error @1.25
$ gpg2 -K
No error, much joy :)
It's not quite so straightforward if the older version has been removed but also works for me (and given the reference to linking errors it might be prudent to uninstall then reinstall gnupg21
after downgrading libgpg-error
if using the method above) :
$ svn checkout -r 150579
https://svn.macports.org/repository/macports/trunk/dports/devel/libgpg-error
Error validating server certificate for 'https://svn.macports.org:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
- Hostname: *.macports.org
- Valid: from Mar 2 07:47:38 2016 GMT until May 2 01:19:52 2017 GMT
- Issuer: GlobalSign Domain Validation CA - SHA256 - G2, GlobalSign nv-sa, BE
- Fingerprint: 3E:AF:D7:EA:81:A4:92:33:B6:BC:DA:38:76:C3:15:54:9A:09:50:E0
(R)eject, accept (t)emporarily or accept (p)ermanently? t
A libgpg-error/files
A libgpg-error/files/patch-configure.diff
A libgpg-error/Portfile
Checked out revision 150579.
$ cd libgpg-error/
$ port install
---> Computing dependencies for libgpg-error
---> Fetching distfiles for libgpg-error
---> Verifying checksums for libgpg-error
---> Extracting libgpg-error
---> Applying patches to libgpg-error
---> Configuring libgpg-error
---> Building libgpg-error
---> Staging libgpg-error into destroot
---> Installing libgpg-error @1.24_0
---> Deactivating libgpg-error @1.25_0
---> Cleaning libgpg-error
---> Activating libgpg-error @1.24_0
---> Cleaning libgpg-error
---> Updating database of binaries
---> Scanning binaries for linking errors
---> Found 16 broken file(s), matching files to ports
---> Found 1 broken port(s), determining rebuild order
---> Rebuilding in order
gnupg21 @2.1.15 +pinentry_mac
Portfile changed since last build; discarding previous state.
---> Computing dependencies for gnupg21
---> Cleaning gnupg21
---> Scanning binaries for linking errors
---> Found 16 broken file(s), matching files to ports
---> Found 1 broken port(s), determining rebuild order
---> Rebuilding in order
gnupg21 @2.1.15 +pinentry_mac
---> Computing dependencies for gnupg21
---> Fetching distfiles for gnupg21
---> Verifying checksums for gnupg21
---> Extracting gnupg21
---> Configuring gnupg21
---> Building gnupg21
---> Staging gnupg21 into destroot
---> Deactivating gnupg21 @2.1.15_0+pinentry_mac
---> Cleaning gnupg21
---> Uninstalling gnupg21 @2.1.15_0+pinentry_mac
---> Cleaning gnupg21
---> Computing dependencies for gnupg21
---> Installing gnupg21 @2.1.15_0+pinentry_mac
---> Activating gnupg21 @2.1.15_0+pinentry_mac
GPG 2.1 uses a new format for its key files. Therefore you cannot use it together with any earlier version of GPG. Neither can you
easily go back to an older version as the old version cannot read the new format.
---> Cleaning gnupg21
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.