gpg: signing failed: Inappropriate ioctl for device Error Message on Linux

Jim Ernst jernst at
Fri Sep 30 19:11:19 CEST 2016

Hi Werner and Justus - thank you for the info !!

Is this issue normally associated with a --passphrase-fd 0 command being used with gpg2? I am doing the following:

    v_passphrase=`cat  pfile.txt`
   /usr/local/bin/gpg2 --batch --local-user $v_recipient --passphrase=$v_passphrase --output $<output file name>  --sign <signed file name>

And it is erroring with :

gpg: signing failed: Inappropriate ioctl for device

I was figuring this was not even trying to utilize any kind of STDIN since it was in --batch mode and not using the "passphrase-fd 0"....

Jim Ernst

-----Original Message-----
From: Werner Koch [mailto:wk at]
Sent: Friday, September 30, 2016 10:14 AM
To: Justus Winter <justus at>
Cc: Jim Ernst <jernst at>; gnupg-users at
Subject: Re: gpg: signing failed: Inappropriate ioctl for device Error Message on Linux

On Fri, 30 Sep 2016 14:37, justus at said:

> fallback pinentry failed to open the terminal due to the fact that
> stdin of the gpg process is not connected to a terminal.  The latter
> can happen for example when gpg is used in a pipe.

That does not matter.  The pinentry opens the tty on its own.  To do this it needs to know the tty.  Fortunately gpg knows the tty or can take it from the GPG_TTY envvar and passes the name of the tty device via gpg-agent up to pinentry.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
NOTE: The sender of this email is an independent contractor of Invacare Corporation or one of its subsidiaries. CONFIDENTIALITY NOTICE: The information in this e-mail message and any attachments may contain privileged, confidential or proprietary information, including confidential health information, protected by applicable Federal or state laws. Such information is intended only for the recipient named above. If you are not the intended recipient, please notify the sender immediately, and take notice that any use, disclosure or distribution of such information is prohibited by law.

More information about the Gnupg-users mailing list