security/gnupg: gpg: signing failed: Invalid IPC response

spag

Member

Reaction score: 6
Messages: 44

Hi, I am having a problem with signing things, any idea what I am doing wrong?
Code:
#echo test | gpg -a --sign --verbose --debug ipc
gpg: Note: no default option file '/root/.gnupg/gpg.conf'
gpg: Warning: using insecure memory!
gpg: enabled debug flags: ipc
gpg: DBG: chan_3 <- OK Pleased to meet you
gpg: DBG: connection to agent established
gpg: DBG: chan_3 -> RESET
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION ttytype=xterm-256color
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> GETINFO version
gpg: DBG: chan_3 <- D 2.2.17
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION allow-pinentry-notify
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> OPTION agent-awareness=2.1.0
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> SCD SERIALNO openpgp
gpg: DBG: chan_3 <- ERR 120196144 Operation not supported by device <SCD>
gpg: using pgp trust model
gpg: DBG: chan_3 -> HAVEKEY 685CC2F44AE7FCAB85478AFB0EAC4A7E469A352 85509FCA7A13A6E9D18A6FH321ADA763C5E2A75
gpg: DBG: chan_3 <- OK
gpg: writing to stdout
gpg: DBG: chan_3 -> KEYINFO 6085CB2F24AE7FCSB8548FB0EAC4A7E469A352
gpg: DBG: chan_3 <- S KEYINFO 6085CB2F44AE7FACAB8548FB0EAC4A7E469A352 D - - - P - - -
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> RESET
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> SIGKEY 6085B2F44AE7FACAB85478FB0EAC4AE469A352
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> SETKEYDESC Please+enter+the+passphrase+to+unlock+the+OpenPGP+secret+key:%0A%22Mon+Bus<mon@localhost>%22%0A4096-bit+RSA+key,+ID+499C3389C183393E2,%0Acreated+2019-10-12.%0A
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> SETHASH 8 93E6D8EBF9E4053CF68B31E5AEA4229D9D3116B173288056127AC78FF8876
gpg: DBG: chan_3 <- OK
gpg: DBG: chan_3 -> PKSIGN
gpg: DBG: chan_3 <- INQUIRE PINENTRY_LAUNCHED 2548 tty 1.1.0 - xterm-256color -
gpg: pinentry launched (2548 tty 1.1.0 - xterm-256color -)
gpg: DBG: chan_3 -> END
gpg: DBG: chan_3 <- ERR 83886340 Invalid IPC response <Pinentry>
gpg: signing failed: Invalid IPC response
-----BEGIN PGP MESSAGE-----

gpg: signing failed: Invalid IPC response
gpg: secmem usage: 1344/32768 bytes in 2 blocks
 
Last edited by a moderator:

Paul Floyd

Member

Reaction score: 11
Messages: 62

I've just been having the same problem (chrome/gpg/kwallet not working).

The loopback option worked after I typed in my passphrase. It then works without loopback for a few minutes and then fails again. What is needed for a permanent fix?
 

Paul Floyd

Member

Reaction score: 11
Messages: 62

Since this is really annoying I've been digging a bit more.

First I tried tracing various things with dwatch. This one

Code:
dwatch -X rw -k gpg2 -k "*pinentry*"
looked interesting. In particular

Code:
2020 Feb 11 11:35:21 501.501 pinentry-tty[24140]: -> "cbreak failure, exiting
" 24 bytes
2020 Feb 11 11:35:21 501.501 pinentry-tty[24140]: -> "ERR 83886179 Operation cancelled <Pinentry>" 43 bytes
Searching for this error message found this

pinentry source

The cbreak source is

C:
static int
cbreak (int fd)
{
  if ((tcgetattr(fd, &o_term)) == -1)
    return -1;
  n_term = o_term;
  n_term.c_lflag = n_term.c_lflag & ~(ECHO|ICANON);
  n_term.c_cc[VMIN] = 1;
  n_term.c_cc[VTIME]= 0;
  if ((tcsetattr(fd, TCSAFLUSH, &n_term)) == -1)
    return -1;
  return 1;
}
So it looks like the problem is that either tcgetattr or tcsetattr is failing.
 

Paul Floyd

Member

Reaction score: 11
Messages: 62

Another small step, I recompiled pinentry-tty and added some traces to cbreak

Code:
2020 Feb 14 12:29:26 501.501 pinentry-tty[19460]: -> "tcgetattr failed Inappropriate ioctl for device fd 0
 
Top