pantry icon indicating copy to clipboard operation
pantry copied to clipboard

gpg-agent doesn't automatically start for gpg

Open sanchitram1 opened this issue 2 years ago • 7 comments

$ which gpg
/Users/psmith/.tea/.local/bin/gpg
$ which gpg-agent
/Users/psmith/.tea/.local/bin/gpg-agent
$ gpg --gen-key
...
Change (N)ame, (E)mail, or (O)kay/(Q)uit? O
gpg: error running '/opt/gnupg.org/v2.4.3/bin/gpg-agent': probably not installed
gpg: failed to start gpg-agent '/opt/gnupg.org/v2.4.3/bin/gpg-agent': Configuration error
gpg: can't connect to the gpg-agent: Configuration error
gpg: agent_genkey failed: No agent running
Key generation failed: No agent running

it should probably look for the gpg-agent in .tea/.local, right?

sanchitram1 avatar Aug 19 '23 14:08 sanchitram1

update: started the agent like so

$ gpg-agent --daemon
gpg-agent[2138]: directory '/Users/me/.gnupg/private-keys-v1.d' created

now pinentry error: gpg-agent[2140]: can't connect to the PIN entry module '/opt/gnupg.org/v2.4.3/bin/pinentry': IPC connect call failed

I looked at the package.yml for gpg, and it doesn't provide a pinentry

sanchitram1 avatar Aug 19 '23 14:08 sanchitram1

and also my environment:

TMPDIR=/var/folders/6q/5yc5_8m10p9gjcfb9t869sjw0000gn/T/
XPC_FLAGS=0x0
TERM=xterm-256color
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.cIMTxIB2OR/Listeners
XPC_SERVICE_NAME=0
TERM_PROGRAM=Apple_Terminal
TERM_PROGRAM_VERSION=445
TERM_SESSION_ID=0B004B3E-782D-4875-9C78-9477CEB64E75
SHELL=/bin/zsh
HOME=/Users/psmith
LOGNAME=psmith
USER=psmith
PATH=/Users/psmith/.local/bin:/Users/psmith/.tea/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
SHLVL=1
PWD=/Users/psmith
OLDPWD=/Users/psmith
GPG_TTY=/dev/ttys001
LANG=en_US.UTF-8

sanchitram1 avatar Aug 19 '23 14:08 sanchitram1

@sanchitram1 , I believe this is fixed as of f71b32abe2c18c941710129e80163f0cfee19901. can you rm -rf ~/.pkgx/gnupg.org and see if it's working for you now?

jhheider avatar Nov 16 '23 23:11 jhheider

still not working, but I get a weird error where I am stuck in this phase:

 ~/ which gpg-agent
/Users/sanch/.pkgx/gnupg.org/v2.4.3/bin/gpg-agent
 ~/ which gpg
/Users/sanch/.pkgx/gnupg.org/v2.4.3/bin/gpg
 ~/ gpg-agent --daemon
gpg-agent: a gpg-agent is already running - not starting a new one
 ~/ gpg --gen-key
gpg (GnuPG) 2.4.3; Copyright (C) 2023 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: sanch
Email address: [email protected]
You selected this USER-ID:
    "sanch <[email protected]>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
Enter passphrase: 

I can't seen to press enter to enter the passphase, but ctrl+C gets me out of here.

sanchitram1 avatar Nov 17 '23 16:11 sanchitram1

Confirmed I'm seeing that as well. that's the only piece that won't take an enter I see. Likely related to pinentry if I had to guess.

jhheider avatar Nov 17 '23 18:11 jhheider

what reason do we have to assume gpg-agent is meant to start itself?

mxcl avatar Nov 25 '23 19:11 mxcl

from what I've seen, it's the expected and normal behavior. on my laptop:

$ killall gpg-agent
$ gpg --sign $something
$ ps aux | grep gpg-agent
jacob            12108   0.0  0.0 408649120   2352   ??  Ss    2:10PM   0:00.04 gpg-agent --homedir /Users/jacob/.gnupg --use-standard-socket --daemon

jhheider avatar Nov 25 '23 19:11 jhheider