keybase / keybase-issues

A single repo for managing publicly recognized issues with the keybase client, installer, and website.
900 stars 37 forks source link

gpg: signing failed: Inappropriate ioctl for device #2798

Open yveoch opened 7 years ago

yveoch commented 7 years ago

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

carlbennett commented 4 years ago

Thank you!

bsodmike commented 4 years ago

Thanks so much, works a treat! Winner winner chicken dinner :D

Sword-Smith commented 4 years ago

+1 karma

alboainin commented 4 years ago

Thank you so much! I have been trying to fix it for 3 hours

srakrn commented 4 years ago

Worked on Microsoft Windows [Version 10.0.19041.173] with WSL 2 (Ubuntu 18.04), thanks a ton!

philmb3487 commented 4 years ago

thank you!

cesc1989 commented 4 years ago

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 commented 4 years ago

alternatively, for fish

set -g -x GPG_TTY (tty)

simonzippy commented 4 years ago

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

patricioe commented 4 years ago

OMG. This saved me. Thank you.

BrunoLavitForgerock commented 4 years ago

Thanks for this nice workaround !!!

allinformatix commented 4 years ago

Live Saver!!!

neeels commented 4 years ago

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 commented 4 years ago

<3 Thanks a lot! <3

ghost commented 4 years ago

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 commented 3 years ago

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

gurkanindibay commented 3 years ago

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

Man you are great you are a life saver

JNKHunter commented 3 years ago

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

vipersniper0501 commented 3 years ago

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 commented 3 years ago

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

sehrishnaveed commented 3 years ago

Thanks a ton!

frei-x commented 3 years ago

Thanks!

deadshot465 commented 3 years ago

Thank you so much!

nate2014jatc commented 3 years ago

Just came across this error trying to import a backup of my private key, you're a life-saver!

naharoo commented 3 years ago

Thank you man! You saved my day 👍

ghost commented 3 years ago

thanks

TruncatedDinoSour commented 3 years ago

Thank you so much <3

Skeeve commented 2 years ago

You just saved my day, @yveoch

fernaspiazu commented 2 years ago

If you're using Powerlevel10k with zsh, be sure the export GPG_TTY=$(tty) line is above of the code that initialize Instant Prompt:

~/.zshrc

export GPG_TTY=$(tty) # Must go before

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Everything else go under here...

https://unix.stackexchange.com/a/608921/507429 https://github.com/romkatv/powerlevel10k/#how-do-i-enable-instant-prompt

hackcoderr commented 2 years ago

saved my time. thanks

Swordington commented 2 years ago

Literally a godsend, thank you forever random github user

interestingLSY commented 2 years ago

work for me! thanks!

TDiblik commented 2 years ago

Hi, for people finding this, you can see/read more about possible fixes, solutions, and problems, similar to this one, here: https://stackoverflow.com/questions/41052538/git-error-gpg-failed-to-sign-data

wemu commented 2 years ago

Hi, for people finding this, you can see/read more about possible fixes, solutions, and problems, similar to this one, here: https://stackoverflow.com/questions/41052538/git-error-gpg-failed-to-sign-data

thanks for the link. I ran into this issue using duplicity for backups. Enabling/Re-configuring pinentry loopback as mentioned in that thread solved my issue.

amsyvah commented 2 years ago

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

gpg2 kdewallet setup Inappropriate ioctl error

This discussion thread is on the "inappropirate ioctl error", doesn't seem to be specific about Kdewallet in Chromium. In FreeBSD plasma environment there is an error while setting up gpg2 keys in chromium, which says Inappropriate ioctl error. May I try this fix export GPG_TTY=$(tty), and am I to type this in the terminal or in a config file?

I also tried these commands following the link from Wemu's post and this is what the terminal said:

$ echo "test" | gpg --clearsign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

test
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device

$ gpg --version
gpg (GnuPG) 2.3.3
libgcrypt 1.9.4

Thank you.

ooonea commented 2 years ago

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

That should be the first thing written on the GPG page. You saved my ass on FreeBSD with git.

minfrin commented 2 years ago

Found this through google, thank you for this link.

amit6257 commented 2 years ago

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

Thanks a ton, it saved hours for me.

Cyberhost-itservice commented 2 years ago

i say mega thx

fireroundgithub commented 2 years ago

T ha

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

Thanks!

lgp547 commented 2 years ago

这是macOS的另一种解决方案****

brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
killall gpg-agent

# now test if it is working
echo "test" | gpg --clearsign

但是,@dryvenn 的原始解决方案只需粘贴export GPG_TTY=$(tty)在您的某个地方,.bashrc或者.zshrc是一个更简单的解决方案,并且也适用于 macOS。

mac path show which pinentry-mac ✅-> /opt/homebrew/bin/pinentry-mac ❌-> /usr/local/bin/pinentry-mac

alexsupa597 commented 2 years ago

If you're using Powerlevel10k with zsh, be sure the export GPG_TTY=$(tty) line is above of the code that initialize Instant Prompt:

~/.zshrc

export GPG_TTY=$(tty) # Must go before

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# Everything else go under here...

https://unix.stackexchange.com/a/608921/507429 https://github.com/romkatv/powerlevel10k/#how-do-i-enable-instant-prompt

Great!!!~

matzeschreiber commented 2 years ago

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

You are godlike. Thank you!

rfernandezdo commented 2 years ago

Thanks!!!

You have helped me with this solution in WSL 2

TruncatedDinoSour commented 1 year ago

Just wanted to stop by and say hello. Clearly I am not the only one who hangs out in this thread.

What's up nerds?

imagine

TruncatedDinoSour commented 1 year ago

@Skeeve more like «A Lb[ii$5Cƹ4iU0*Zp~oʰ_x%i

rclements-redhat commented 1 year ago

It's a beautiful thing when the top result is the fix.

gnarizzy commented 1 year ago

Over six years later and this helped me out, thank you yveoch!

yuowo39 commented 1 year ago

I found another way to sovle it.

~/.gnupg/gpg.conf use-agent pinentry-mode loopback

~/.gnupg/gpg-agent.conf allow-loopback-pinentry

Resource: https://d.sb/2016/11/gpg-inappropriate-ioctl-for-device-errors

DesertLizard-man commented 1 year ago

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

cant express how grateful i am to encounter this post, thank you very much