Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpg: no gpg-agent running this session #2599

Closed
mirror-kt opened this issue Aug 26, 2021 · 12 comments · Fixed by #3109
Closed

gpg: no gpg-agent running this session #2599

mirror-kt opened this issue Aug 26, 2021 · 12 comments · Fixed by #3109
Labels
help-wanted Extra attention is needed

Comments

@mirror-kt
Copy link

After updating gpg to 2.3.2, when I try to use gpg, I get an error saying that gpg-agent is not running.
The commands and errors I tried are as follows

PS C:\Users\kanom> gpg --version
gpg (GnuPG) 2.3.2
libgcrypt 1.9.4
Copyright (C) 2021 g10 Code GmbH
License GNU GPL-3.0-or-later <https://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: C:\Users\kanom\scoop\apps\gpg\current\home
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
AEAD: EAX, OCB
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
PS C:\Users\kanom> gpg-agent.exe
gpg-agent[17380]: no gpg-agent running in this session
PS C:\Users\kanom> gpg-connect-agent.exe /bye
gpg-connect-agent: no running gpg-agent - starting 'C:\\Users\\kanom\\scoop\\apps\\gpg\\current\\bin\\gpg-agent.exe'
gpg-connect-agent: Using CREATE_BREAKAWAY_FROM_JOB flag
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 gpg-agent: IPC connect call failed
gpg-connect-agent: error sending standard options: No agent running
PS C:\Users\kanom> gpg --card-status
gpg: Using CREATE_BREAKAWAY_FROM_JOB flag
gpg: can't connect to the gpg-agent: IPC connect call failed
gpg: OpenPGP card not available: No agent running

When we tried installing the same version of gpg without scoop, the command worked fine, so there seems to be a problem with the installation method using scoop.

PS C:\Program Files (x86)\GnuPG\bin> .\gpg --version
gpg (GnuPG) 2.3.2
libgcrypt 1.9.4
Copyright (C) 2021 g10 Code GmbH
License GNU GPL-3.0-or-later <https://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: C:\Users\kanom\AppData\Roaming\gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
AEAD: EAX, OCB
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
PS C:\Program Files (x86)\GnuPG\bin> .\gpg-agent.exe
gpg-agent[24108]: no gpg-agent running in this session
PS C:\Program Files (x86)\GnuPG\bin> .\gpg-connect-agent.exe /bye
gpg-connect-agent: no running gpg-agent - starting 'C:\\Program Files (x86)\\GnuPG\\bin\\gpg-agent.exe'
gpg-connect-agent: Using CREATE_BREAKAWAY_FROM_JOB flag
gpg-connect-agent: waiting for the agent to come up ... (5s)
gpg-connect-agent: connection to the agent established
PS C:\Program Files (x86)\GnuPG\bin> .\gpg --card-status
Reader ...........: Sony FeliCa Port/PaSoRi 3.0 0
Application ID ...: D2760001240100000006154140340000
Application type .: OpenPGP
Version ..........: 0.0
Manufacturer .....: Yubico
Serial number ....:  <secret>
Name of cardholder: Misato Kano
Language prefs ...: ja
Salutation .......:
URL of public key : https://keybase.io/mirror_kt/pgp_keys.asc
Login data .......: [not set]
Signature PIN ....: not forced
Key attributes ...: nistp521 nistp521 rsa2048
Max. PIN lengths .: 127 127 127
PIN retry counter : 3 0 3
Signature counter : 590
KDF setting ......: off
UIF setting ......: Sign=off Decrypt=off Auth=off
Signature key ....: 86B1 9548 6A20 AD76 C869  7A4E 1B9F F442 BC18 ADB8
      created ....: 2020-12-06 16:22:43
Encryption key....: 7D45 6403 FB85 1067 E282  6E56 A718 1867 604D 3F45
      created ....: 2020-12-06 16:23:20
Authentication key: [none]
General key info..: [none]
@Eterocell
Copy link

Same issue here. I've reverted back to 2.3.1 and held gpg update as a temporary workaround.

@mgziminsky
Copy link

Was having the same issue and managed to fix it by manually creating the directory gnupg at the root of the install: mkdir "$env:SCOOP\apps\gpg\current\gnupg"

There may be a better solution for actually fixing the manifest, but I decided to try this after doing a bit of research and noticing that the output from gpgconf --list-dirs contained several references to that location, the important ones being the socket paths.

@MarkKoz
Copy link
Contributor

MarkKoz commented Aug 30, 2021

For some reason, gpg is refusing to respect the GNUPGHOME environment variable. gpg --version shows its set to ~\scoop\apps\gpg\current\home but it's looking for the socket in ~\scoop\apps\gpg\current\gnupg\S.gpg-agent. It seems like it's treating ~\scoop\apps\gpg\current\gnupg as the home directory despite what gpg --version shows. The notable thing I discovered is that ~\scoop\apps\gpg\current\home is a junction to ~\scoop\persist\gpg\home. If --homedir is used to specify the home dir in the persist directory, the agent actually finds the socket. This isn't a solution in practice since I cannot specify it when I need to use gpg through git. GNUPGHOME should be the way to do that, but it unfortunately doesn't work.

https://dev.gnupg.org/T5537 is a suspicious changed introduced with 2.3.2, but I'll need to investigate further. It's not yet clear if this is a bug with gpg or the manifest just needs to be changed to comply with a recent change.

@MarkKoz
Copy link
Contributor

MarkKoz commented Aug 30, 2021

The reason GNUPGHOME isn't respected is that this is the portable version of gpg. This is determined by the presence of a gpgconf.ctl file next to gpgconf.exe. Therefore, unless --homedir is specified, it will always use the default location, which is a directory named home relative to the installation directory. This can be seen in standard_homedir()

2.3.1 socket dir used gnupg_homedir() for Windows as seen here. gnupg_homedir() calls default_homedir() which calls standard_homedir() for portable apps on Windows. In short, on 2.3.1 the socket directory was the home directory in the installation directory.

2.3.2 had a change to the socket dir behaviour on Windows. As seen here, it now uses the gnupg directory relative to the installation root rather than a directory named home. I feel like this is a bug; it should've been "home". What likely happened is that the author mistakenly thought gnupg was the name of the home dir, since that's the default for non-portable versions.

Whether it's intended behaviour or not, I think simply making a directory named gnupg is the way to address this. I was going to suggest making it a junction to the home directory, but I'm not sure if it's worth the hassle.

@eseiker
Copy link

eseiker commented Sep 3, 2021

changing persist to ["home", ["home", "gnupg"]] in scoop manifest might be a workaround while upstream behavior doesn't fix?

@rozbo
Copy link

rozbo commented Oct 16, 2021

any news?

@rozbo
Copy link

rozbo commented Oct 16, 2021

and how to install old version ?
I've tried

scoop install gpg@2.2.32

for install lts, but I got

Searching hash for gnupg-w32-2.2.32_$matchDate.exe in https://www.gnupg.org/download/integrity_check.html
Could not find hash in https://www.gnupg.org/download/integrity_check.html
Downloading gnupg-w32-2.2.32_$matchDate.exe to compute hashes!
The remote server returned an error: (404) Not Found.

@stale
Copy link

stale bot commented Oct 30, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 30, 2021
@rashil2000 rashil2000 added the help-wanted Extra attention is needed label Oct 30, 2021
@stale stale bot removed the stale label Oct 30, 2021
@giva01121
Copy link

Any news?

@niheaven
Copy link
Member

I don't know why, but gpg@2.3.1 works.

Try scoop install gpg@2.3.1 as a temporal solution.

@clumbo
Copy link

clumbo commented Nov 20, 2021

I don't know why, but gpg@2.3.1 works.

Try scoop install gpg@2.3.1 as a temporal solution.

Doesn't work for me ;(

C:\Users\clumbo>scoop install gpg@2.3.1
WARN Given version (2.3.1) does not match manifest (2.3.3)
WARN Attempting to generate manifest for 'gpg' (2.3.1)
Autoupdating gpg
Searching hash for gnupg-w32-2.3.1_$matchDate.exe in https://www.gnupg.org/download/integrity_check.html
Could not find hash in https://www.gnupg.org/download/integrity_check.html
Downloading gnupg-w32-2.3.1_$matchDate.exe to compute hashes!
The remote server returned an error: (404) Not Found.
URL https://www.gnupg.org/ftp/gcrypt/binary/gnupg-w32-2.3.1_$matchDate.exe#/dl.7z is not valid
Could not find hash!
Could not install gpg@2.3.1

@ajariel
Copy link
Contributor

ajariel commented Nov 22, 2021

Doesn't work for me ;(

You could try installing the old version like this:

scoop install https://raw.githubusercontent.com/ScoopInstaller/Main/15d3b247156bae77eb227649ec35746719d1f2ea/bucket/gpg.json
scoop hold gpg

Seems to work fine on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help-wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.