error return code when no agent available

Andreas Stieger astieger at
Thu Nov 30 16:14:02 CET 2017

On 11/30/2017 03:57 PM, Werner Koch wrote:
> On Thu, 30 Nov 2017 13:26, astieger at said:
>> The return code of 2 seems to depends specifically on the availability
>> of an agent binary. This is a minimal installer system where no agent is
> The agent is required because gpg needs to check whether it has a
> matching secret key for the imported public key.

Ah okay that's a reason.

>> Previously this was not an issue. Do you know what and why this changed?
>> If this is intentional, is there a work-around in terms of settings or
>> the CLI?
> The gpg-agent is a part of GnuPG and has been since 2003.  With 2.0 you
> could get away without it because gpg did not yet utilize the agent for
> private key store (in contrast to gpgsm). 

Under the assumption that the operation executed is public key only and
does not involve private keys, --no-autostart may fix this specific case.

> The return codes from gpg have no specific meaning.  For scripting you
> need to look at the status lines.  GPGME entirely ignores the return
> codes.



Andreas Stieger <astieger at>
Project Manager Security
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton,
HRB 21284 (AG Nürnberg)

More information about the Gnupg-devel mailing list