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

Justus Winter justus at
Fri Sep 30 14:37:31 CEST 2016


please don't drop the mailing list when replying.

Jim Ernst <jernst at> writes:
>> I am currently testing keys I created using gpg version 2 2.1.15 (libgcrypt 1.7.3) and I am trying to encrypt a file using a shell script in a LINUX environment. I am getting the following error when the command is executed:
>> gpg: signing failed: Inappropriate ioctl for device
>> Has anyone encountered this issue ?
> Yes.
> Was the "echo test | gpg2 --sign --armor -u $USER" the method for fixing the issue ? I am running on a Linux box .

No.  You were asking if anyone else has encountered the issue, and I
replied by pointing you to the bug report of someone who also
encountered the issue.

The problem is that either there is no graphical pinentry, or there is,
but it cannot execute e.g. due to DISPLAY not being set, *and* the
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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: </pipermail/attachments/20160930/4ae5b743/attachment.sig>

More information about the Gnupg-users mailing list