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

GPG2, pinentry, gnome3: : Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x340000b (kitty) #2451

Closed
martbhell opened this issue Mar 19, 2020 · 5 comments

Comments

@martbhell
Copy link

Hello!

I can't get GPG to work with kitty without setting TERM=xterm :/
This is all happening on my Laptop, no sshing anywhere.
It is with Gnome, but I want to use the ncurses pinentry, changing to the gnome3 one did not make it work.

Last thing I found was this error message which pops up.
I have not been able to figure out which environment variable that GPG wants. $GPG_TTY is set. Unsetting it does not help.

Mar 19 09:24:48 LAPTOPNAEM org.gnome.Shell.desktop[8917]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x340000b (kitty)

$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l
$ kitty --debug-config
kitty 0.16.0 (644ee646a2) created by Kovid Goyal
Linux LAPTOPNAEM 5.3.0-42-generic #34~18.04.1-Ubuntu SMP Fri Feb 28 13:42:26 UTC 2020 x86_64
Ubuntu 18.04.4 LTS \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
Running under: X11

Config options different from defaults:
$
$
$ kitty --version
kitty 0.16.0 created by Kovid Goyal
$ ps fu -ea|grep gpg-agen[t]
me    12569  0.0  0.0 175372  3836 ?        SLs  09:05   0:00  \_ /usr/bin/gpg-agent --supervised
$ gpg --version
gpg (GnuPG) 2.2.4
libgcrypt 1.8.1
$ echo $TERM
xterm-kitty
$ ls -l /etc/alternatives/pinentry
lrwxrwxrwx 1 root root 24 maali 18 13:52 /etc/alternatives/pinentry -> /usr/bin/pinentry-curses

$ gpg --verbose --edit-key MYKEY 
gpg (GnuPG) 2.2.4; Copyright (C) 2017 Free Software Foundation, Inc.
Secret key is available.

gpg: using pgp trust model
gpg> passwd
gpg: pinentry launched (14089 curses 1.1.0 /dev/pts/0 xterm-kitty :1)
gpg: key KEY1: error changing passphrase: Required environment variable not set
gpg: pinentry launched (14090 curses 1.1.0 /dev/pts/0 xterm-kitty :1)
gpg: key MYKEY: error changing passphrase: Required environment variable not set
gpg> 

# and if I 
TERM=xterm
# then when I run the gpg --edit-key and passwd I get a nice curses popup in the terminal asking for the key password
$ echo $TERMINFO
/home/myusername/.local/kitty.app/lib/kitty/terminfo
$ echo $GPG_TTY
/dev/pts/0
$ ls -la ~/.gnupg/gpg-agent
ls: cannot access '.gnupg/gpg-agent': No such file or directory
$ tail /var/log/syslog
Mar 19 09:24:48 LAPTOPNAEM org.gnome.Shell.desktop[8917]: Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x340000b (kitty)
@kovidgoyal
Copy link
Owner

I have no idea what GPG wants, you will need to ask its developers. Most
likely it has some hardcoded checks against the value of TERM instead of
using the terminfo database properly.

@kovidgoyal
Copy link
Owner

And I will note that on my system, running

DISPLAY= gpg --edit-key whatever
gpg> passwd

brings up a ncurses pinetry, as expected.

You might need to instally the kitty terminfo files system wide or in
~/.termifo if gpg ignores the TERMINFO env var.

@kovidgoyal
Copy link
Owner

For posterity, the easiest way to install the terminfo files in
~/.terminfo is

kitty +kitten ssh localhost

@martbhell
Copy link
Author

And I will note that on my system, running

DISPLAY= gpg --edit-key whatever
gpg> passwd

brings up a ncurses pinetry, as expected.

You might need to instally the kitty terminfo files system wide or in
~/.termifo if gpg ignores the TERMINFO env var.

Ah! This last bit is what was needed. Copying the terminfo file into ~/.terminfo/x/ got the thing working
Thanks for the very quick help!

@razin99
Copy link

razin99 commented May 9, 2022

Note to self and others who may encounter an issue with the kitty +kitten ssh localhost command:

  • mkdir -p ~/.terminfo/x
  • ln -s $(infocmp -a xterm-kitty | grep file | cut -d':' -f2) ~/.terminfo/x/xterm-kitty

lj-ditrapani added a commit to lj-ditrapani/init that referenced this issue Jul 22, 2022
kitty-terminfo is needed for gpg to work with kitty!
The script installer does not set it up.
<kovidgoyal/kitty#2451>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants