Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpg: signing failed: Inappropriate ioctl for device #2798

Open
yveoch opened this issue Feb 2, 2017 · 73 comments
Open

gpg: signing failed: Inappropriate ioctl for device #2798

yveoch opened this issue Feb 2, 2017 · 73 comments

Comments

@yveoch
Copy link

@yveoch yveoch commented Feb 2, 2017

When trying to use the bash+curl verifying method on a server, this cryptic error message might happen:

gpg: signing failed: Inappropriate ioctl for device

Since this is a fatal error and also quite difficult to debug, maybe the fix could be put somewhere (in the provided command line?):

export GPG_TTY=$(tty)

source

@diego898
Copy link

@diego898 diego898 commented Nov 1, 2017

I cannot tell you how grateful I am to you!

@cfig
Copy link

@cfig cfig commented Dec 8, 2017

@dryvenn You are a life saver! THX!

@dminca
Copy link

@dminca dminca commented Jan 31, 2018

You're a saviour! Helped me on Fedora.

@danduk82
Copy link

@danduk82 danduk82 commented Feb 7, 2018

really thanks a lot

@boltzjf
Copy link

@boltzjf boltzjf commented Feb 9, 2018

Wow, you are so cool, helped me a lot!

Thank you so so much!!!

@kenvac
Copy link

@kenvac kenvac commented Feb 13, 2018

Thanks a tonne man!!. Helped me on debian 9.

@Turini
Copy link

@Turini Turini commented Mar 15, 2018

helped me a lot also! thank you

zanshin added a commit to zanshin/dotfiles that referenced this issue Mar 15, 2018
GPG_TTY needs to be set to the value in tty ($(tty)) in order for GPG to
work properly with mutt. keybase/keybase-issues#2798
@TheOpenDevProject
Copy link

@TheOpenDevProject TheOpenDevProject commented Mar 24, 2018

Cheers!.

@tejasmob
Copy link

@tejasmob tejasmob commented May 1, 2018

You're truly rockstar man! 🥇
Thanks!

@ivy-dong
Copy link

@ivy-dong ivy-dong commented May 4, 2018

Amazing
really thanks a lot

@abhi-jha
Copy link

@abhi-jha abhi-jha commented May 4, 2018

Oh wow. And I was pulling my hair that my key has expired which it definitely didn't. I don't know why I was thinking its 2019 for some reason. Thank you.

@netsafe
Copy link

@netsafe netsafe commented May 7, 2018

works inside a docker container Deian stretch both host and container

@hlzhang
Copy link

@hlzhang hlzhang commented Jun 11, 2018

Sadly, no tty on travis-ci or appveyor.
GPG 2.1.11 comes with ubuntu 16.04 throw out a invalid error if I add 'pinentry-mode loopback' into ~/.gnupg/gpg.conf.
Various versions of gpg wasted lot of my time and I think it is a piece of shit, they don't test it on different environments?

@jamesdbloom
Copy link

@jamesdbloom jamesdbloom commented Jun 20, 2018

This doesn't work for me because when I add that setting GPG doesn't sign some artefacts properly anymore.

@netsafe
Copy link

@netsafe netsafe commented Jun 21, 2018

@chshawkn Travis-CI - in my opinion - is a very questionable CI solution... Call me classy, but I'm still using Jenkins and it never ever failed me regardless of the task and environment I used. With Windows slave all the problems were gone when I used WinSSHD - just write your scripts properly and have fun

@hlzhang
Copy link

@hlzhang hlzhang commented Jul 11, 2018

@netsafe Thanks for your advice. I use Gitlab CI/CD and Jenkins on private projects. Travis-CI is for public repositories.

I've solved the GPG issues on Gitlab CI/CD, Travis-CI and AppVeyor, one script works on all CI platforms.

see: https://github.com/ci-and-cd/maven-build/blob/develop/src/main/ci-script/lib_ci.sh#L702

@rootVIII
Copy link

@rootVIII rootVIII commented Sep 17, 2018

worked for me on Ubuntu 18... thanks

@svenluijten
Copy link

@svenluijten svenluijten commented Oct 10, 2018

I cannot thank you enough! ❤️ Hours were lost debugging this 🙈

@maxtaco
Copy link
Contributor

@maxtaco maxtaco commented Oct 11, 2018

Wow, can't believe how many thumbs this issue has. I had a half a mind to update the website to fill in GPG_TTY=$(tty) as suggested in this issue, but that only works in bash, and the current command line seems to work in tcsh too. Looks like we need a flow here to: (1) have users select their shell; and (2) to give you the right command to setenv given the shell. I guess alternatively we can always run bash -c 'lots of commands | other commands', but we'd need another level of quoting.

@josefigueroa-nedap
Copy link

@josefigueroa-nedap josefigueroa-nedap commented Oct 29, 2018

It also works on OSX using zsh. Thanks!

@dmjio
Copy link

@dmjio dmjio commented Nov 25, 2018

@dryvenn nice, works on nixos.

@dadiyang
Copy link

@dadiyang dadiyang commented Dec 2, 2018

It works! Thank you so much!

@jamalkaksouri
Copy link

@jamalkaksouri jamalkaksouri commented Feb 21, 2019

@dryvenn thank you, works on ubuntu subsystem.

zsh support

@teddybear
Copy link

@teddybear teddybear commented Feb 26, 2019

Thank you!

@stevenchen3
Copy link

@stevenchen3 stevenchen3 commented Feb 27, 2019

Kudos!!!! This saves me a lot of time. Appreciated.

@ghost
Copy link

@ghost ghost commented Mar 30, 2019

Thank you so much!

I had this problem where I had my user.signingKey set to the correct value in Git on Ubuntu 18.04 after following this tutorial, but I was still unable to sign commits. Every time I tried, I got this error:

error: gpg failed to sign the data
fatal: failed to write commit object

This fixed that right up. Thanks again!

@sinetek
Copy link

@sinetek sinetek commented May 24, 2020

thank you!

@cesc1989
Copy link

@cesc1989 cesc1989 commented Jun 26, 2020

Incredible, 2020, Jun 26 and this still the solution 😄

For the record, the problem I had was:

gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device
@haroonKhan-10p
Copy link

@haroonKhan-10p haroonKhan-10p commented Jul 12, 2020

alternatively, for fish

set -g -x GPG_TTY (tty)

@simonzippy
Copy link

@simonzippy simonzippy commented Jul 23, 2020

Adding my praise to the chorus here - thank you for this great solution.

@patricioe
Copy link

@patricioe patricioe commented Jul 24, 2020

OMG. This saved me. Thank you.

@BrunoLavitForgerock
Copy link

@BrunoLavitForgerock BrunoLavitForgerock commented Jul 29, 2020

Thanks for this nice workaround !!!

@allinformatix
Copy link

@allinformatix allinformatix commented Sep 11, 2020

Live Saver!!!

@neeels
Copy link

@neeels neeels commented Sep 17, 2020

setting
export GPG_TTY=$(tty)
was half of the solution for me, the other half was
apt-get install pinentry-curses
so that gpg asks for the GPG key passphrase on the terminal (because on remote server via ssh)

@hyperxpro
Copy link

@hyperxpro hyperxpro commented Oct 15, 2020

<3 Thanks a lot! <3

apupier added a commit to camel-tooling/camel-language-server that referenced this issue Nov 13, 2020
lihaoyi added a commit to com-lihaoyi/Ammonite that referenced this issue Nov 24, 2020
@ghost
Copy link

@ghost ghost commented Dec 1, 2020

There's this once nice workaround you can do, at least on Arch Linux, which is adding:
GPG_TTY=$(tty) to the /etc/environment file. This takes effect system-wide at startup.

@MrNossiom
Copy link

@MrNossiom MrNossiom commented Dec 21, 2020

Maybe we could close this issue ? No... ?

@gurkanindibay
Copy link

@gurkanindibay gurkanindibay commented Jan 5, 2021

When trying to use the bash+curl verifying method on a server, this cryptic error message might happen:

gpg: signing failed: Inappropriate ioctl for device

Since this is a fatal error and also quite difficult to debug, maybe the fix could be put somewhere (in the provided command line?):

export GPG_TTY=$(tty)

source

Men you are great you are a life saver

@JNKHunter
Copy link

@JNKHunter JNKHunter commented Jan 22, 2021

I think you just saved me a week. Thank you! 🍻

yevgenypats added a commit to cloudquery/golang-cross that referenced this issue Feb 8, 2021
@vipersniper0501
Copy link

@vipersniper0501 vipersniper0501 commented Feb 13, 2021

Wow, can't believe how many thumbs this issue has. I had a half a mind to update the website to fill in GPG_TTY=$(tty) as suggested in this issue, but that only works in bash, and the current command line seems to work in tcsh too. Looks like we need a flow here to: (1) have users select their shell; and (2) to give you the right command to setenv given the shell. I guess alternatively we can always run bash -c 'lots of commands | other commands', but we'd need another level of quoting.

In this stack overflow answer you can find out how to add the export GPG_TTY=$(tty) to a .zshrc for zsh
https://unix.stackexchange.com/questions/608842/zshrc-export-gpg-tty-tty-says-not-a-tty

@kislyuk
Copy link

@kislyuk kislyuk commented Mar 24, 2021

Thank you so much to the OP. This issue is a poster child for how user-hostile gnupg is.

alanmynah added a commit to alanmynah/ohmyzsh that referenced this issue Apr 7, 2021
When setting up GPG commit signing on Github ([example walkthrough article](https://sabbour.me/setting-up-signed-git-commits-on-macos/)), can get this error
`gpg: signing failed: Inappropriate ioctl for device`
keybase/keybase-issues#2798

a fix is proposed to be to `export GPG_TTY=$(tty)` and put that into `~/.bash_profile`. 
but according to this post 
https://unix.stackexchange.com/a/608921
`export GPG_TTY=$TTY` is better. 

The change has been tested, here's the test commit
alanmynah/cheat-sheets@8ff6913
@sehrishnaveed
Copy link

@sehrishnaveed sehrishnaveed commented May 6, 2021

Thanks a ton!

@frei-x
Copy link

@frei-x frei-x commented Jun 10, 2021

Thanks!

@deadshot465
Copy link

@deadshot465 deadshot465 commented Jun 10, 2021

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet