gnupg-agent not running properly

Bug #684902 reported by hyper_ch on 2010-12-03
This bug affects 18 people
Affects Status Importance Assigned to Milestone
Kubuntu PPA
gnupg2 (Ubuntu)

Bug Description

HI there

I just upgraded from Maverick KDE 4.5.3 and I have a problem signing outgoing emails in KMail. When trying to sign outgoing email I get this generic error "Signing failed: General error".

I then tried to pinpoint down the issue and started Kleopatra. It reports the following error:

"Check that gpg-agent is running and that the GPG_AGENT_INFO variable is set up-to-date"

I then purged the gnupga-agent package (sudo apt-get purge gnupg-agent) and reinstalled it and kleopatra. The same problems appears.

In the ~/.gnupg folder I found various gnugp-agnet files. The gpg-agent.conf did not mention the above variable but the gpg-agent-info-HOSTNAME file does. For me it contains currently:


I don't know what that should be changed to.

Also when I try to run gpg-agent from the cli I get this error:

"gpg-agent[4794]: can't connect to `/home/hyper/.gnupg/S.gpg-agent': No such file or directory"

Qt: 4.7.0
KDE Development Platform: 4.5.80 (4.6 Beta1)
KMail: 1.13.5

I can confirm this on 4.6 RC1

Bruno (bruno666-666) wrote :

I had a similar issue on KDE 4.6 RC. This works for me :

Add keep-dipslay and display options in ~/.gnupg/gpg-agent.conf :

pinentry-program /usr/bin/pinentry-qt4
display :0.0
default-cache-ttl 86400
max-cache-ttl 86400

Create a file under the directory ~/.kde/env/ . I named it (don't forget to make it executable):

eval `gpg-agent --daemon`

Also create the directory ~/.kde/shutdown/ and place another shell script in it (e.g. again with the following contents:

[ -n "${GPG_AGENT_INFO}" ] && kill `echo "${GPG_AGENT_INFO}" | cut -d ':' -f 2`


That seems to work in RC2 :) thx

Benjamin Wohlwend (piquadrat) wrote :

I had to add the "--enable-ssh-support" flag to "eval `gpg-agent --daemon`" in Bruno's workaround, but now it works.

It would be really cool if this was properly resolved. It's a major pain in the ... when you have to work with ssh sessions all the time...

Andrey Bondarenko (abone) wrote :

Have you tried to add "use-agent" into ~/.gnupg/gpg.conf. This should enable starting gpg-agent by /etc/X11/Xsession.d/90gpg-agent. Probably, it is rather unintuitive, but work for me in Kubuntu 11.04 (Natty).

You can also add "enable-ssh-support".

The change in comment #8 works for me too. Is this a bug in gnupg?

Dennis Schridde (devurandom) wrote :

The issue exists here in plain Kubuntu 12.04 without any PPAs.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gnupg2 (Ubuntu):
status: New → Confirmed
Jessie Morris (jessieamorris) wrote :

I too am having this issue. Stock 12.04 Kubuntu with Kgpg installed.

erintiransom (israelplanaguma) wrote :

I have this same problem with Ubuntu 12.04 64-bits. The file gpg.conf already had the "use-agent" option.

Kleopatra self-test says "IPC parameter error".

I can't get to trust other people's certificates. I can't verify downloads. Sometimes the certificates list is empty, sometimes it's not.

Very frustrating, Kleopatra in Windows works pretty much flawlessly -it freezes every now and then, but you just have to kill the process and restart the program.

I've tried to switch to Ubuntu several times, but I always end up back in Windows...

ianni67 (ianni67) wrote :

I'm experiencing the same problem here (Kubuntu 12.04) and this is a show-stopping for me for Kmail. I'm in serious trouble.

Any solution or work-around? For me all the suggested workarounds listed here until now do not work.

ianni67 (ianni67) wrote :

I fixed the problem in two steps:
- create a file gpg.conf-2 in ~/.gnupg (touch ~/.gnupg/gpg.conf-2)
- clean the gnupg.conf file removing (commenting out) the spare lines:
#debug-level basic
#log-file socket:///home/ianni/.gnupg/log-socket
#debug-level basic
which where created due to a bug which is also mentioned (indirectly) in;
- deinstalling kleopatra and installing kgpg.

Now everything works again. I hope this can help someone.

Bashar (bashar-mc) wrote :

I fixed it this way on both 12.04 and 14.04 and i think this also the correct fix

chmod a+x /etc/X11/Xsession.d/90gpg-agent

Check ~/.gnupg/gpg.conf
If not create it and add on one line:

chk if gpg-agent started
chk if $GPG_AGENT_INFO has something in it

fire Kleopatra and shoud work

Paul Loughman (snowhog) wrote :

Bashar -

Thank you! Your 'fix' worked for me on Kubuntu 14.10 (KDE 4.14.2) kernel 3.16.0-31-generic. This issue had me stumped for months. Very happy to have everything working now.

James Wilde (james-wilde) wrote :

Bashar's solution did not work for me. I'm running 14-04.

I did the chmod (needed sudo in front, of course).
I had a gpg.conf file which did not have the 'use-agent' line so I added it first after the introductory blurb.
Rebooted and checked that gpg-agent was running with ps -ef | grep gpg-agent.
Ran echo $GPG-AGENT-INFO but got another line than the one in Bashar's post:
There is a directory /tmp/gpg-aE7ygt which contains the following file:
srwxrwxr-x 1 james james 0 jun 3 10:35 S.gpg-agent
Any attempt to read the file comes up with S.gpg-agent: No such device or address
Kleopatra still barfs at the Gpg-Agent Connectivity test.

Would be really nice to get this working as I'm trying to get people I know to use gpg encryption.

Jonathan Polak (jpolak) wrote :

@james-wilde this problem exists upstream from ubuntu. I'm using KDE on Debian - same IPC connectivity issue -- 5 years later!!

Hi all, I have no issues with gpg-agent.

debug-level basic
log-file /home/scarlett/.gnupg/log-socket
pinentry-program /usr/bin/pinentry
default-cache-ttl 180000

And most importantly in .bashrc I had to put:
export GPG_TTY

which I found here:

Changed in kubuntu-ppa:
status: New → Invalid

Removed Kubuntu PPA - there are no version of gnupg-agent in any of our PPAs.

BryanFRitt (bryanfritt) wrote :

I found a script that helps to fix this (or at least passes Kleopatra self test for 'Gpg-Agent Connectivity' now)
Found this in ~/.gnupg/
(don't remember details behind why I originally had this file, and how it later lost execution permission.
But one I gave it execution permission and ran it, the remaining Kleopatra test passed. 'Gpg-Agent Connectivity')
[Note: using Debian and KDE]



# Decide wether to start gpg-agent daemon.
# Create necessary symbolic link in $HOME/.gnupg/S.gpg-agent

# modified slightly from original
# Whatever this file does, it helps make it so the the Kleopatra Self-Test Results for 'Gpg-Agent Connectivity' pass

#PIDOF=$(pidof gpg-agent)

if [ "$RETVAL" -eq 1 ]; then
        echo "Starting gpg-agent daemon. "
        eval "$(gpg-agent --daemon)"
        echo "Daemon gpg-agent already running. "

#echo " Nasty way to find gpg-agent's socket file... "
GPG_SOCKET_FILE=$(find /tmp/gpg-* -name $SOCKET)
echo "Updating socket file link. "
cp -fs "$GPG_SOCKET_FILE" "$HOME/.gnupg/S.gpg-agent"

tags: added: eol gnupg-agent natty
removed: gnupg-agnet
Vincent Fortier (th0ma7) wrote :

I think this is similar to #684902

Vincent Fortier (th0ma7) wrote :

wrong post...
a duplicate of this bug maybe:

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.