23

On Fedora 22, gpg doesn't find gpg-agent:

% gpg-agent --daemon                                           

% gpg -vvv --use-agent --no-tty --decrypt file.gpg 
gpg: using character set `utf-8'
:pubkey enc packet: version 3, algo 1, keyid 3060B8F7271AFBAF
  data: [4094 bits]
gpg: public key is 271AFBAF
gpg: using subkey 271AFBAF instead of primary key 50EA64D5
gpg: using subkey 271AFBAF instead of primary key 50EA64D5
gpg: gpg-agent is not available in this session
gpg: Sorry, no terminal at all requested - can't get input

2 Answers 2

37

Looking at the versions reveals the problem:

% gpg-agent --version
gpg-agent (GnuPG) 2.1.7

% gpg --version                                                               
gpg (GnuPG) 1.4.19

The components come from different packages (gnupg2-2.1.7-1.fc22.x86_64 and gnupg-1.4.19-2.fc22.x86_64 in my case). The solution is to use the gpg2 command instead of gpg.

2
  • 1
    thanks. i spent 30 minutes on the internet trying to figure out this stuff... turns out that most documentation and instructions do not take into account the breakage between versions of the tools. i was having to type in my passphrase for every run of gpg on 20 files i wanted to sign, now i can just do it once. thanks again.
    – don bright
    Feb 9, 2017 at 3:59
  • this is still relevant with Fedora 27; using gpg2 also enables the gnome integration Feb 21, 2018 at 13:32
8

In case it's helpful for some, gpg 1.4 can work just fine with gpg-agent 2.1.

When looking into it, I found this post: https://lists.gnupg.org/pipermail/gnupg-devel/2014-October/029024.html

The agent is compatible, but no longer exports the environment variables that the older version of gpg expects. If you set those manually it will just work:

export GPG_AGENT_INFO=${HOME}/.gnupg/S.gpg-agent:0:1

1
  • Fedora uses different default socket path. I had to use GPG_AGENT_INFO=/run/user/$(id -u)/gnupg/S.gpg-agent:0:1 instead. Jun 7, 2018 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .