You are not logged in.

#1 2014-12-12 22:53:41

mjandrews
Member
From: Nottingham, UK
Registered: 2013-03-26
Posts: 17

[solved] keychain not finding existing gpg-agent

I've recently installed arch on new machine. I am encountering an issue on this machine which I do not encounter on my other machines.

On my new machine, just like all others, I use keychain for passwordless ssh. I have the following in my ~/.zshrc (which has served me well for years)

if which keychain >/dev/null; then
	## hopefully run the ssh keychain
	keychain -q ~/.ssh/id_rsa ;
	source ~/.keychain/${HOST}-sh;
fi

When I initially login on the new machine, e.g. after a reboot, I get a prompt for my passphrase, and thereafter I can do passwordless ssh. However, every new shell I open provides the following error message

* Error: Failed to start gpg-agent

which is an error I can always replicate if I explicitly run keychain on the command line.

What is strange is that
1) A gpg-agent is running and this is easily verified with a pgrep.
2) The passwordless ssh is still working. 
3) This does not happen on my other machines, nor has it ever happened. If an gpg-agent is already running, then every time keychain is invoked explicitly, it says it "Found existing gpg-agent".

The relevant packages, all pacman installed, are

> pacman -Q | grep -E '(keychain|gnupg|gpg)'
gnupg 2.1.0-6
gpgme 1.5.2-1
keychain 2.7.1-3
libgpg-error 1.17-1

Does anyone know why keychain might be failing to find an existing gpg-agent?

Last edited by mjandrews (2014-12-14 00:54:51)

Offline

#2 2014-12-12 23:24:17

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] keychain not finding existing gpg-agent

This was one of the changes after GnuPG 2.1. The message is misleading because it should read "Failed to start because it is already running..."
I got tired of this and just added a check to my .zprofile:

if [[ -z $(pidof ssh-agent) && -z $(pidof gpg-agent) ]]; then
...

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-12-13 02:54:44

mjandrews
Member
From: Nottingham, UK
Registered: 2013-03-26
Posts: 17

Re: [solved] keychain not finding existing gpg-agent

Thanks. I do a similar check in my zshrc.

Offline

#4 2014-12-13 03:06:58

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] keychain not finding existing gpg-agent

And you still get the error message? That fixed it for me...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-12-13 06:47:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] keychain not finding existing gpg-agent

jasonwryan wrote:

And you still get the error message? That fixed it for me...

I did the same thing and it fixed it for me as well.

Offline

#6 2014-12-13 21:21:52

mjandrews
Member
From: Nottingham, UK
Registered: 2013-03-26
Posts: 17

Re: [solved] keychain not finding existing gpg-agent

Sorry. I made a typo in reply!
Instead of saying  "I do a similar check...", I had meant to say "I *will* do a similar check...".
I have done so now and it does work perfectly.

Last edited by mjandrews (2014-12-13 21:22:07)

Offline

#7 2014-12-13 21:28:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [solved] keychain not finding existing gpg-agent

Cool. Please remember to mark your thread as [Solved] by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2014-12-14 00:59:06

mjandrews
Member
From: Nottingham, UK
Registered: 2013-03-26
Posts: 17

Re: [solved] keychain not finding existing gpg-agent

No problem. I was hesitant to do so initially because I wasn't sure whether, technically speaking, if the original problem was solved, or if it was just avoided. In any case, the problem I was faced with has now ceased to be a problem, so I am happy to mark it as solved.

Last edited by mjandrews (2014-12-14 13:11:31)

Offline

#9 2015-02-02 11:06:06

emlun
Member
Registered: 2013-10-27
Posts: 2

Re: [solved] keychain not finding existing gpg-agent

This has now been fixed in upstream, but it's not in a versioned release yet so it probably won't be in [extra] anytime soon. I made an AUR package while we wait for an official release.

Offline

Board footer

Powered by FluxBB