keyboard is unresponsive while kinto is active
17hao opened this issue · 8 comments
I have used kinto for a long time. It is suddenly doesn't work tody. I tried to reinstall kinto, but the keyboard was unresponsive. And I tried to upgrade xkeysnail to 0.4.0, but still not work.
I also tried to start kinto by python3 ~/.config/kinto/kinto.py
, the error message is here:
└─▪ python3 kinto.py
Traceback (most recent call last):
File "/home/sqh/.config/kinto/kinto.py", line 5, in <module>
from xkeysnail.transform import *
File "/home/sqh/.local/lib/python3.11/site-packages/xkeysnail/transform.py", line 7, in <module>
from .output import send_combo, send_key_action, send_key, is_pressed
File "/home/sqh/.local/lib/python3.11/site-packages/xkeysnail/output.py", line 30, in <module>
_uinput = UInput(events={ecodes.EV_KEY: _keyboard_codes,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/evdev/uinput.py", line 124, in __init__
self._verify()
File "/usr/local/lib/python3.11/dist-packages/evdev/uinput.py", line 271, in _verify
raise UInputError(msg.format(self.devnode))
evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
I googled it, but didn't find the solution.
Thanks for any helping.
I'm not the Kinto dev, but I also have used it for a few years, and contributed some things to the config.
First, don't upgrade xkeysnail
to 0.4.0, this breaks the ability to do keyboard shortcuts like Cmd+Tab where you need to be able to hold down the modifier key. To fix this, you need to reinstall the version of xkeysnail
that the Kinto installer clones into the Kinto install folder (usually ~/Downloads/kinto-master/xkeysnail
). The simplest way is to run the Kinto installer again, but make sure you back up your kinto.py
file if you do that, it will get overwritten by the installer.
python3 ~/.config/kinto/kinto.py
This is not correct, you can't just run the Kinto config file directly. The config is a Python file, but it gets incorporated into the keymapper as it starts. You need to run the keymapper command directly with sudo
, and then point it at the kinto.py
config file. Something like this:
sudo xkeysnail --watch ~/.config/kinto/kinto.py
The command used in the xkeysnail.service
file is a bit more complicated, since it tries to kill any existing xkeysnail
process to avoid conflicts, and has to use xhost
to open up the X server to root.
ExecStart={sudo}/bin/bash -c '/usr/bin/xhost +SI:localuser:root && {homedir}/.config/kinto/killdups.sh && {xkeysnail} --quiet --watch {homedir}/.config/kinto/kinto.py'
The Kinto installer also has to replace all the things in "{}" with hard-coded references to make this work. You can't just copy and paste this.
It would probably be helpful to know what Linux distro and desktop environment you are on, to have a better chance of figuring out what the problem is.
If we can't fix this quickly, I have an alternative project that is based on Kinto but works quite a bit differently behind the scenes. But it would be good to identify the problem that Kinto is having, if we can.
@RedBearAK Thanks for your reply.
Background:
I swiched from Ubuntu 20 to Debian 12 about 3 months ago. Kinto works well in Ubuntu.
I guess the problem is related to Linux distro or desktop environment, but I can't find any log or error message.
Linux distro: Debian 12
Desktop Environment: GNOME Shell 43.6
Window System: Wayland
Python Version: Python 3.11.2
I tried 2 commands:
sudo xkeysnail --watch ~/.config/kinto/kinto.py
/usr/bin/sudo /bin/bash -c '/usr/bin/xhost +SI:localuser:root && /home/sqh/.config/kinto/killdups.sh && /usr/local/bin/xkeysnail --watch /home/sqh/.config/kinto/kinto.py'
(withtou--quiet
option)
But after I start kinto by gui, the keyboard is unresponsive.
journalctl output:
Nov 20 23:33:51 debian systemd[1]: xkeysnail.service: Scheduled restart job, restart counter is at 117.
Nov 20 23:33:51 debian systemd[1]: Stopped xkeysnail.service - xkeysnail.
Nov 20 23:33:51 debian systemd[1]: Started xkeysnail.service - xkeysnail.
Nov 20 23:33:51 debian sudo[47817]: root : PWD=/ ; USER=root ; COMMAND=/bin/bash -c '/usr/bin/xhost +SI:localuser:root && /home/sqh/.config/kinto/killdups.sh && /usr/local/bin/xkeysnail --quiet --watch /home/sqh/.config/kinto/kinto.py'
Nov 20 23:33:51 debian sudo[47817]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Nov 20 23:33:51 debian sudo[47819]: Authorization required, but no authorization protocol specified
Nov 20 23:33:51 debian sudo[47819]: /usr/bin/xhost: unable to open display ":0"
Nov 20 23:33:51 debian sudo[47817]: pam_unix(sudo:session): session closed for user root
Nov 20 23:33:51 debian systemd[1]: xkeysnail.service: Main process exited, code=exited, status=1/FAILURE
Nov 20 23:33:51 debian systemd[1]: xkeysnail.service: Failed with result 'exit-code'.
Did you switch from logging into the X11 session to the Wayland session recently? Kinto is not yet compatible with Wayland. Though I’m not sure why the keyboard would be completely unresponsive.
If you need to use Wayland you’ll have to stop Kinto, disable its autostart option, and try my project Toshy. It has Wayland support as long as you are using GNOME or KDE Plasma or sway. I’ve tested it on stock Debian. There are a few notes in the README.
https://github.com/RedBearAK/toshy
Or, if you can stay in the X11 session, Kinto should work again. Unless there is an additional problem that is being covered up by being logged into a Wayland session.
I have never logged into X11 session.
I tried to switch to X11 session, and reinstall Kinto, but Kinto still not work.
journalctl output:
Nov 21 09:40:52 debian systemd[1]: Stopped xkeysnail.service - xkeysnail.
Nov 21 09:52:17 debian systemd[1]: Started xkeysnail.service - xkeysnail.
Nov 21 09:52:17 debian sudo[17142]: root : PWD=/ ; USER=root ; COMMAND=/bin/bash -c '/usr/bin/xhost +SI:localuser:root && /home/sqh/.config/kinto/killd>
Nov 21 09:52:17 debian sudo[17142]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:52:17 debian sudo[17150]: localuser:root being added to access control list
Nov 21 09:52:24 debian systemd[1]: Stopping xkeysnail.service - xkeysnail...
Nov 21 09:52:24 debian sudo[17192]: root : PWD=/ ; USER=root ; COMMAND=/bin/bash -c '/usr/bin/sudo pkill -f bin/xkeysnail && exit 0'
Nov 21 09:52:24 debian sudo[17192]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:52:24 debian sudo[17194]: root : PWD=/ ; USER=root ; COMMAND=/usr/bin/pkill -f bin/xkeysnail
Nov 21 09:52:24 debian sudo[17194]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Nov 21 09:52:24 debian sudo[17194]: pam_unix(sudo:session): session closed for user root
Nov 21 09:52:24 debian sudo[17192]: pam_unix(sudo:session): session closed for user root
Nov 21 09:52:24 debian systemd[1]: xkeysnail.service: Control process exited, code=killed, status=15/TERM
Nov 21 09:52:25 debian sudo[17142]: pam_unix(sudo:session): session closed for user root
Nov 21 09:52:25 debian systemd[1]: xkeysnail.service: Failed with result 'si
loginctl output:
└─▪ loginctl session-status 2
2 - sqh (1000)
Since: Tue 2023-11-21 10:00:32 CST; 7min ago
Leader: 1646 (gdm-session-wor)
Seat: seat0; vc2
TTY: tty2
Service: gdm-password; type x11; class user
State: active
Unit: session-2.scope
├─1646 "gdm-session-worker [pam/gdm-password]"
├─1785 /usr/libexec/gdm-x-session --run-script /usr/bin/gnome-session
├─1790 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty -novtswit>
├─1851 /usr/libexec/gnome-session-binary
├─1902 /usr/bin/ssh-agent /usr/bin/im-launch /usr/bin/gnome-session
└─1913 /usr/bin/fcitx5 -d
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (EE) systemd-logind: failed to take device /dev/input/event21: No such device
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (**) py-evdev-uinput: always reports core events
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (**) Option "Device" "/dev/input/event21"
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (EE) xf86OpenSerial: Cannot open device /dev/input/event21
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: Permission denied.
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (II) event21: opening input device '/dev/input/event21' failed (Permission denied).
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (II) event21 - failed to create input device '/dev/input/event21'.
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (EE) libinput: py-evdev-uinput: Failed to create a device for /dev/input/event21
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (EE) PreInit returned 2 for "py-evdev-uinput"
Nov 21 10:03:56 debian /usr/libexec/gdm-x-session[1790]: (II) UnloadModule: "libinput"
Try to run the manual command from earlier after disabling the service. See what it says.
I take your suggestion, switch to keyszer.
Now every thing goes well.🚀
Thanks for your help!
FYI, you won't have any Wayland support unless you switch entirely to Toshy. Just switching from xkeysnail
to keyszer
is not enough, but it will fix your immediate problem with the keyboard being unresponsive. 👍🏽
I took the new suggested Kinto config from that old comment and changed it even more and made Toshy, and Toshy installs a special development branch of keyszer
to enable the Wayland support.
Eventually it will be more difficult to stay in the X11 session, even on Debian.