Page MenuHome GnuPG

symmetric encryption exits with non-zero exit code
Closed, ResolvedPublic


Symmetric encryption in GnuPG2 exits with non-zero exit code (2) even though
ecryption itself proceeds correctly (text is encrypted well). Whenever one
tries to encrypt a text using a symmetric key in batchmode, the side effect is:

gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running

And exit code is 2.

gpg2 --homedir ./.gnupg --batch --passphrase password --output encrypted.file
--cipher-algo 3DES --symmetric plaintext.file



Event Timeline

t8m set Version to 2.0.18.
t8m added a subscriber: t8m.

Actually not a bug - the --homedir ./.gnupg causes it.

t8m removed a project: Bug Report.
t8m added a project: Bug Report.

Well actually it is a bug. :) The homedir specification should work.

There are actually two bugs:

  1. the homedir is not forwarded to gpg-agent when it is started from gpg2
  1. even if I start gpg-agent manually the homedir must be specified as absolute

path, not relative - this is very inconvenient

t8m changed Version from 2.0.18 to 2.0.19.Jul 24 2012, 11:09 AM

Can you please at least acknowledge whether these are bugs or not?

I can't replicate your problem. You need to make sure that gpg is able to
connect the agent. This either done by setting GPG_AGENT_INFO properly or by
starting the agent like

cd myhomedir
GNUPGHOME=$(pwd) gpg-agent --daemon /bin/sh

and then run gpg in that shell.

The issue is that when the gpg starts the agent by itself (that is there is no
agent currently running) it does not forward the --homedir option.

And another issue is that the homedir can not be specified as relative path.
(OK, that could be accepted as security feature).

Agreed: Homedir should be passed to the agent. Will be changed for 2.1 and
maybe backported to 2.0.

Fixed for 2.1. I don't think backporting makes much sense. Upgrading to 2.1 is
for sure the better solution if you have a real problem with that behaviour.

werner claimed this task.