Ubuntu 7.10: Gpg-agent not running
Contents
Problem
I've installed gpg-agent with the command:
sudo apt-get install gpg-agent
But gpg-agent is not running after a reboot:
$> ps aux | grep gpg myname 5702 5639 0 08:06 pts/1 00:00:00 grep gpg $>
Solution
It appeared I was missing `use-agent' in ~/.gnupg/gpg.conf:
echo use-agent >> ~/.gnupg/gpg.conf
I choose to install gpg2 besides gpg (the installation of Ubuntu packages depends on gpg, so I'm not going to advise you to remove gpg):
sudo apt-get remove gpg sudo apt-get install gpg2 cp /usr/share/gnupg2/gpg-conf.skel ~/.gnupg/gpg.conf echo use-agent >> ~/.gnupg/gpg.conf
Environment
- Ubuntu-7.10 (Gutsy Gibbon)
See also
- Ubuntu documentation - Gnu Privacy Guard Howto
- GPG on Ubuntu howto, very informative
- Debian 4.0: Installing gpg-agent
- How to install gpg-agent on Debian
Journal
20080314
gpg-agent should be started by /etc/X11/Xsession.d/90gpg-agent. I can see no errors in /var/log/*.log.
Content of /etc/X11/Xsession.d/90gpg-agent:
$> cat /etc/X11/Xsession.d/90gpg-agent
: ${GNUPGHOME=$HOME/.gnupg}
GPGAGENT=/usr/bin/gpg-agent
PID_FILE="$GNUPGHOME/gpg-agent-info-$(hostname)"
if grep -qs '^[[:space:]]*use-agent' "$GNUPGHOME/gpg.conf" "$GNUPGHOME/options" &&
test -x $GPGAGENT &&
{ test -z "$GPG_AGENT_INFO" || ! $GPGAGENT 2>/dev/null; }; then
if [ -r "$PID_FILE" ]; then
. "$PID_FILE"
fi
# Invoking gpg-agent with no arguments exits successfully if the agent
# is already running as pointed by $GPG_AGENT_INFO
if ! $GPGAGENT 2>/dev/null; then
$GPGAGENT --daemon --sh >"$PID_FILE"
. "$PID_FILE"
fi
fi
From apt-cache search gpg I can see there is also a package `gnome-gpg' - maybe I can try that one if gpg-agent fails(?):
gnome-gpg - GPG passphrase agent based on GNOME Keyring
From /etc/X11/Xsession.d/90gpg-agent it appears I should've set the option `use-agent' in ~/.gnupg/gpg.conf.
Maybe I have an old gpg.conf. Tried moving ~/.gnupg to ~/.gnupg_ and reinstalling gnupg-agent with sudo apt-get install --reinstall gnupg-agent, but ~/.gnupg is not created.
There is also a sudo apt-get install gnupg2
From GnuPrivacyGuardHowto - Tips and Tricks I read I can recreate ~/.gnupg/gpg.conf by running cp /usr/share/gnupg/options.skel ~/.gnupg/gpg.conf
GPG-2.0.4 is available, and the above wiki page says "While both of them can & do co-exist with each other its preferable to uninstall gpg before installing gpg2.", so let's use this full:
OOPS: Didn't I remove too much(?):
$> sudo apt-get remove gpg gpg2 ... The following packages will be REMOVED: apturl gnome-app-install gnupg gnupg2 libgpgme11 mutt python-gnupginterface python-software-properties software-properties-gtk ubufox ubuntu-desktop ubuntu-keyring ubuntu-minimal update-manager update-manager-core update-notifier ... $> sudo apt-get install gpg2
Receiving messages with first invocation of gpg2:
$> gpg2 gpg: directory `/home/myname/.gnupg' created gpg: can't open `/usr/share/gnupg/gpg-conf.skel': No such file or directory gpg: keyring `/home/myname/.gnupg/secring.gpg' created gpg: keyring `/home/myname/.gnupg/pubring.gpg' created gpg: Go ahead and type your message ...
Gpg2 should've get the skeleton from /usr/share/gnupg2 instead of gnupg. Manual fix:
cp /usr/share/gnupg2/gpg-conf.skel ~/.gnupg/gpg.conf echo use-agent >> ~/.gnupg/gpg.conf
After X restart, gpg-agent has started :-):
$> ps -ef | grep gpg myname 6675 1 0 09:58 ? 00:00:00 /usr/bin/gpg-agent --daemon --sh myname 6872 6864 0 09:59 pts/0 00:00:00 grep gpg
20080317
After having removed the gpg package, apt-get is unable to verify:
$> sudo apt-get update W: GPG error: http://security.ubuntu.com gutsy-security Release: Could not execute '/usr/bin/gpgv' to verify signature (is gnupg installed?) W: GPG error: http://nl.archive.ubuntu.com gutsy Release: Could not execute '/usr/bin/gpgv' to verify signature (is gnupg installed?) W: GPG error: http://archive.ubuntu.com gutsy Release: Could not execute '/usr/bin/gpgv' to verify signature (is gnupg installed?) W: GPG error: http://nl.archive.ubuntu.com gutsy-updates Release: Could not execute '/usr/bin/gpgv' to verify signature (is gnupg installed?) W: You may want to run apt-get update to correct these problems
These warnings were silenced by re-installing gnupg:
sudo apt-get install gnupg