pkgxdev / pantry

pkg manifests
https://pkgx.dev/pkgs/
171 stars 117 forks source link

gpg-agent doesn't automatically start for gpg #2962

Open sanchitram1 opened 1 year ago

sanchitram1 commented 1 year ago
$ 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 commented 1 year ago

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 commented 1 year ago

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
jhheider commented 11 months ago

@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?

sanchitram1 commented 11 months ago

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: test@test.com
You selected this USER-ID:
    "sanch <test@test.com>"

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.

jhheider commented 11 months ago

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.

mxcl commented 11 months ago

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

jhheider commented 11 months ago

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