#59 ✓released
Rob Speed

gpg-agent can't bind to a socket

Reported by Rob Speed | June 29th, 2011 @ 05:02 AM | in 2.0.18 (closed)

I'm not able to use gpg in any way because pinentry never prompts me for my passphrase. I've done a bit of sleuthing, but I'm at a dead end now.

The initial problem:

glados:~ rspeed$ gpg2 --armor --sign --detach-sig .profile 

You need a passphrase to unlock the secret key for
user: "Rob Speed <rspeed@bounteo.us>"
1024-bit DSA key, ID 150CAAC6, created 2004-07-11

gpg: can't connect to the agent: IPC connect call failed
gpg: problem with the agent: No agent running
gpg: no default secret key: Operation cancelled
gpg: signing failed: Operation cancelled

Testing gpg-agent:

glados:~ rspeed$ gpg-agent
gpg-agent: no gpg-agent running in this session
glados:~ rspeed$ gpg-agent --daemon
gpg-agent[88999]: error binding socket to `/Users/rspeed/.gnupg/S.gpg-agent': Invalid argument

That error makes no sense to me. I can delete that socket from the filesystem, but it doesn't accomplish anything.

GPG version

glados:~ rspeed$ gpg --version
gpg (GnuPG/MacGPG2) 2.0.17
libgcrypt 1.4.6
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA
        CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Other debugging steps taken:

Moved ~/.gnupg and ran gpg-agent --daemon; same result.

Uninstalled and reinstalled the GnuPG package; same result.

Created a new user, logged in and ran gpg-agent --daemon; same result.

System info

I'm running Mac OS X 10.7 11A494a (the most recent developer build). I know this worked in te past and I can't think of anything that has changed (other than the OS builds).

Is there any other data I can provide?

Comments and changes to this ticket

  • Alex (via GPGTools)

    Alex (via GPGTools) July 3rd, 2011 @ 12:49 AM

    • Assigned user set to “Benjamin Donnachie”
    • State changed from “new” to “hold”
    • Milestone cleared.
    • Importance changed from “High” to “”

    Thank you for your report. Does anything from this script help? https://github.com/GPGTools/GPGTools_Core/blob/master/scripts/fix_g...
    Have you installed MacGPG2 from gpgtools.org?

  • Lukas Loesche

    Lukas Loesche July 18th, 2011 @ 12:36 PM

    I can confirm the Problem on OSX Server 10.6.8 with the latest Version of GPGTools from gpgtools.org (GPGTools-20110711.dmg).

    client-88:.gnupg lukas$ gpg-agent --daemon
    gpg-agent[1632]: error binding socket to `/Users/lukas/.gnupg/S.gpg-agent': Invalid argument
    client-88:.gnupg lukas$ gpg-agent --version
    gpg-agent (GnuPG/MacGPG2) 2.0.17
    libgcrypt 1.4.6
    client-88:.gnupg lukas$ ls -al
    total 48
    drwx------+   9 lukas  staff   306 Jul 18 12:10 .
    drwxr-xr-x+ 155 lukas  staff  5270 Jul 18 12:07 ..
    srwxr-xr-x    1 lukas  staff     0 Jul 18 12:10 S.gpg-agent
    -rw-------+   1 lukas  staff   140 May 19 13:57 gpg.conf
    drwx------+   2 lukas  staff    68 Aug 24  2010 private-keys-v1.d
    -rw-------+   1 lukas  staff  3443 Aug 24  2010 pubring.gpg
    -rw-------+   1 lukas  staff   600 Aug 24  2010 random_seed
    -rw-------+   1 lukas  staff  6101 Aug 24  2010 secring.gpg
    -rw-------+   1 lukas  staff  1360 Aug 24  2010 trustdb.gpg
    client-88:scripts lukas$ ./fix_gpg.sh 
    [gpg] Removing invalid symbolic links...
    [gpg] Linking gpg2...
    [gpg] Checking gpg.conf...
    [gpg] Fixing permissions...
    client-88:scripts lukas$ gpg-agent --daemon
    gpg-agent[1811]: error binding socket to `/Users/lukas/.gnupg/S.gpg-agent': Invalid argument
    client-88:~ lukas$ uname -a
    Darwin client-88.dyn.hq 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
    sh-3.2# ls -al /usr/local/bin/
    total 488
    drwxr-xr-x  8 root           wheel    272 Jul 18 12:22 .
    drwxr-xr-x  7 root           wheel    238 Jul 18 11:50 ..
    lrwxr-xr-x  1 root           wheel     27 Jul 18 11:50 gpg -> /usr/local/MacGPG2/bin/gpg2
    lrwxr-xr-x  1 root           wheel     32 Jul 18 11:50 gpg-agent -> /usr/local/MacGPG2/bin/gpg-agent
    lrwxr-xr-x  1 root           wheel     27 Jul 18 12:22 gpg2 -> /usr/local/MacGPG2/bin/gpg2

    dtruss shows:

     2192/0x243a:  socket(0x1, 0x1, 0x0)             = 6 0
     2192/0x243a:  bind(0x6, 0x18004C0, 0x21)                = -1 Err#48
     2192/0x243a:  socket(0x1, 0x1, 0x0)             = 7 0
     2192/0x243a:  connect(0x7, 0xBFFFF73E, 0x21)            = -1 Err#61
     2192/0x243a:  close(0x7)                = 0 0
     2192/0x243a:  lstat64("/Users/lukas/.gnupg/S.gpg-agent\0", 0xBFFFF7E4, 0x21)            = 0 0
     2192/0x243a:  unlink("/Users/lukas/.gnupg/S.gpg-agent\0", 0xBFFFF7E4, 0x21)             = 0 0
     2192/0x243a:  bind(0x6, 0x18004C0, 0x21)                = -1 Err#22
     2192/0x243a:  open("/usr/local/MacGPG2/share/locale/en/LC_MESSAGES/gnupg2.mo\0", 0x0, 0x1800000)                = 7 0
     2192/0x243a:  fstat(0x7, 0xBFFFF4D4, 0x1800000)                 = 0 0
     2192/0x243a:  mmap(0x0, 0x29BE2, 0x1, 0x2, 0x7, 0x1FFFFFFFF)            = 0x2C9000 0
     2192/0x243a:  close(0x7)                = 0 0
     2192/0x243a:  write(0x2, "gpg-agent[2192]: error binding socket to \342\200\230/Users/lukas/.gnupg/S.gpg-agent\342\200\231: Invalid argument\n\0", 0x61)                = 97 0

    Complete trace file is attached.

  • Alex (via GPGTools)
  • SLInterpreter

    SLInterpreter July 27th, 2011 @ 04:39 PM

    I see the identical behaviour as here. (Indeed reported it as part of entry number #2.) I would add the output from that script but it relies on using Apple Mail, which for personal reasons I do not wish to use on this machine. However, I have attached the output from this script.

  • Alex (via GPGTools)

    Alex (via GPGTools) July 27th, 2011 @ 05:14 PM

    Thanks - I've just enhanced the debug script. Could you please update it and attach the debug information again?

  • Lukas Loesche
  • Alex (via GPGTools)
  • Michael Williams

    Michael Williams August 2nd, 2011 @ 08:04 PM

    see what I posted in #2, it may help this issue since it appears that in the ls -al output above that the .gnupg folder has ACLs on it (evidenced by the + at the end of permissions).

  • Alex (via GPGTools)

    Alex (via GPGTools) August 2nd, 2011 @ 10:28 PM

    Thank you very much. Interesting. If this is the solution we'll integrated it into the installer (already enhanced the debug script).

  • HJ

    HJ November 16th, 2011 @ 08:55 AM

    Hi all, the problem described up top still occurs for me on 10.5.8 with GPGTools-20111114. I created and ran fix_gpg.sh per Alex's suggestion, but that complained about not being able to find fix_gpg_permissions.sh -- which GPGTools didn't seem to install. So I had to poke around github to find that second script (grabbed it from here ), create it in the same directory, and then try again. This seems to have fixed the problem!

    In any case, this still affects the current stable installer package, at least for me.

  • Alex (via GPGTools)

    Alex (via GPGTools) November 16th, 2011 @ 09:06 AM

    • State changed from “hold” to “open”
  • Alex (via GPGTools)

    Alex (via GPGTools) December 28th, 2011 @ 01:26 PM

    • Milestone set to 2.0.18
    • Importance changed from “” to “”
  • steve

    steve January 3rd, 2012 @ 04:00 PM

    • Assigned user changed from “Benjamin Donnachie” to “Mento”
    • State changed from “open” to “fixed”
  • steve

    steve June 18th, 2015 @ 04:40 PM

    • State changed from “fixed” to “released”
    • Importance cleared.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins