gopass: Pinentry error `ERR 83918950 Inappropriate ioctl for device`

Summary

When setting up a new age backend on Kali Linux 2021.1 with gopass init --crypto age I get:

Error: Failed to initialize store: failed to read user input: pinentry Error: unexpected response: ERR 83918950 Inappropriate ioctl for device <Pinentry>

Steps To Reproduce

gopass init --crypto age Follow setup prompts Enter password for your new keypair: Retype password for your new keypair: ⏳ This can take a long time. If you get impatient see https://github.com/gopasspw/gopass/b lob/master/docs/entropy.md Continue? [Y/n/q]: 🔑 Please enter your passphrase to unlock the age keyring 2021/03/25 11:24:59 failed to create new private key: failed to create new private key: pin entry Error: unexpected response: ERR 83918950 Inappropriate ioctl for device <Pinentry>

Expected behavior

Accepts PIN and creates new gopass store

Environment

  • OS: Kali Linux 2021.1
  • OS version: Linux kali 5.10.0-kali3-amd64 #1 SMP Debian 5.10.13-1kali1 (2021-02-08) x86_64 GNU/Linux
  • gopass Version: 1.12.4
  • Installation method: Downloaded amd64 tar.tz from Releases

Additional context

From the debug log:

2021/03/25 11:25:32.636902 age/keyring.go:43    age.(*Age).genKey       No native age key found. Generating ... 
2021/03/25 11:25:32.637016 age/keyring.go:85    age.(*Age).loadKeyring  no password callback found, redirecting to askPass                                            
2021/03/25 11:25:32.637069 age/keyring.go:94    age.(*Age).loadKeyring  can't decrypt keyring at /root/.config/gopass/age-keyring.age: open /root/.config/gopass/age-keyring.age: no such file or directory                                                                      
2021/03/25 11:25:32.637107 age/keyring.go:66    age.(*Age).generateIdentity     failed to load existing keyring from /root/.config/gopass/age-keyring.age: open /root/.config/gopass/age-keyring.age: no such file or directory                                                  
2021/03/25 11:25:32.637143 age/keyring.go:70    age.(*Age).generateIdentity     no existing keyring, creating new one                                                                 
2021/03/25 11:25:32.637212 age/keyring.go:118   age.(*Age).saveKeyring  no password callback found, redirecting to askPass                                                            
2021/03/25 11:25:32.637303 age/askpass.go:63    age.(*askPass).Passphrase       Value for /root/.config/gopass/age-keyring.age not found in cache                                     
2021/03/25 11:25:32.637400 gpgconf/gpgconf.go:20        gpgconf.Path    /usr/bin/gpgconf [gpgconf]                                                                                    
2021/03/25 11:25:32.680771 pinentry/pinentry.go:130     pinentry.(*Client).GetPin       message: "S ERROR curses.isatty 83918950 "                                                    
2021/03/25 11:25:32.681314 action/errors.go:59  action.ExitError        failed to read user input: pinentry Error: unexpected response: ERR 83918950 Inappropriate ioctl for device <Pinentry> - stacktrace: %!v(MISSING)  

Using ncurses pinentry, however thought this shouldn’t matter since the fallback GetPin() would takeover if there was an error.

update-alternatives --config pinentry
There are 2 choices for the alternative pinentry (providing /usr/bin/pinentry).

Selection    Path                      Priority   Status
  0            /usr/bin/pinentry-gnome3   90        auto mode
* 1            /usr/bin/pinentry-curses   50        manual mode
  2            /usr/bin/pinentry-gnome3   90        manual mode

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 4
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Also: did you set export GPG_TTY=$(tty)?

After updating export GPG_TTY=$(tty) one must tell GPG agent about it with gpg-connect-agent updatestartuptty /bye. So, pinentry will pop up on this tty.

$ cat .kshrc                                                                                                                                                                                                             
[...]
export GPG_TTY=$(tty)
[..]
$ env                 
[...]
GPG_TTY=/dev/ttyp2
[...]
$ gopass init --crypto age
🍭 Initializing a new password store ...
🔑 Searching for usable private Keys ...
⚠ Hint: Use 'gopass init <subkey> to use subkeys!'
🔑 No existing age identities found. Do you want to generate a new one? [Y/n/q]: Y

Error: Failed to initialize store: failed to read user input: pinentry (/usr/local/bin/pinentry) error: unexpected response: ERR 83918950 Inappropriate ioctl for device <Pinentry>

Environment

OS: OpenBSD 7.0 -current gopass version: gopass 1.13.0 go1.17.5 openbsd amd64 pinentry version: pinentry-1.1.1 Installation method: Installed from OpenBSD ports