swhkd freezes keyboard upon execution
Version Information:
- Distribution Information ( run
uname -a) - Linux Arch 6.12.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Jan 2025 02:26:57 +0000 x86_64 GNU/Linux
- swhkd 1.2.1
Describe the bug:
When executing swhks & pkexec swhkd, the keyboard freezes. I am unable to use any system keybinds, type anything, even use of REISUB failed. The only way to terminate the process is by performing a hard reboot (I cannot close the terminal using only mouse).
Expected behavior:
- Self-explanatory
Actual behavior:
- Inability to use keyboard.
To Reproduce:
- I didn't do anything special, just installed it from the AUR, copied the config file from sxhkd, and attempted to run it.
Additional information:
- Might have something to do with keyd remapping daemon.
@newtoallofthis123 can you kindly look into this issue?
On Sun, Jan 26, 2025 at 8:52 AM Letus252 @.***> wrote:
Assigned #293 https://github.com/waycrate/swhkd/issues/293 to @Shinyzenith https://github.com/Shinyzenith.
— Reply to this email directly, view it on GitHub https://github.com/waycrate/swhkd/issues/293#event-16068777100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOP54YVTIVVO6AAFD7MODTD2MRIFTAVCNFSM6AAAAABV37TC2KVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJWGA3DQNZXG4YTAMA . You are receiving this because you were assigned.Message ID: @.***>
That seems weird Will look into it asap
@Letus252
It would most likely either have to do something in your config file that is not compatible with swhkd or that the communication between the daemon and the server has either timed out or in infinite wait which would mean that uinput attaches to the keyboard but doesn't respond to any key events.
I am leaning towards the wait condition problem, however in the meanwhile, relevant config files or logs would be very helpful while I look into it. Thank you :)
This is definitely a problem with the keyd daemon: If I stop the keyd service first, I can launch swhkd without any issues, and my keybinds work as expected.
I replaced the configuration file with an empty file. When launching swhkd while the keyd daemon is active, my keyboard still freezes, so the issue is not with my config file.
Although it probably is not related I had to create a symlink to /etc/swhkd/swhkdrc as suggested in this comment:
The first problem is that
swhkdtries to use the config in your~/.configdirectory that's stored in theXDG_CONFIG_HOMEenvironment variable. However sincepkexecdoesn't pass-through all environment variables (such asXDG_CONFIG_HOME),swhkdfalls back to a hardcoded path that is/etc/swhkd/swhkdrcThe second problem is that
swhkderrors if the config file doesn't exist at the path it decides on. A workaround is to create that file, which will fix the errors, but it'll still warn you thatXDG_CONFIG_HOMEis not set, but there'll be no errors and it'll work fine.You can also symlink your personal config file (i.e.
~/.config/swhkd/swhkdrc) to the hardcoded/etc/swhkd/swhkdrc, if you want to feel that this problem didn't exist in the first placesudo ln -sf ~/.config/swhkd/swhkdrc /etc/swhkd
I set the timer to close the wayland session using sleep 40; loginctl terminate-session 1 and then ran swhks (no issue so far) and pkexec swhkd -d > swhkd.log 2>&1 (which froze my keyboard).
Here are the logs:
[2025-01-26T12:51:08Z TRACE swhkd] Logger initialized.
[2025-01-26T12:51:08Z TRACE swhkd] Invoking UID: 1000
[2025-01-26T12:51:08Z TRACE swhkd] Setting process umask.
[2025-01-26T12:51:08Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2025-01-26T12:51:08Z DEBUG swhkd] Created runtime directory.
[2025-01-26T12:51:08Z DEBUG swhkd] Set runtime directory to readonly.
[2025-01-26T12:51:08Z WARN swhkd] Running swhkd as root!
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting initgroups...
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting EGID...
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting EUID...
[2025-01-26T12:51:08Z ERROR swhkd] XDG_CONFIG_HOME has not been set.
[2025-01-26T12:51:08Z DEBUG swhkd] Using config file path: "/etc/swhkd/swhkdrc"
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting EGID...
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting EUID...
[2025-01-26T12:51:08Z DEBUG swhkd::perms] Setting initgroups...
[2025-01-26T12:51:08Z TRACE swhkd] Attempting to find all keyboard file descriptors.
[2025-01-26T12:51:08Z TRACE swhkd] Other: Sleep Button
[2025-01-26T12:51:08Z TRACE swhkd] Other: Power Button
[2025-01-26T12:51:08Z TRACE swhkd] Other: Power Button
[2025-01-26T12:51:08Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-01-26T12:51:08Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard Consumer Control
[2025-01-26T12:51:08Z TRACE swhkd] Other: LIZHI 750-B IC USB Keyboard System Control
[2025-01-26T12:51:08Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-01-26T12:51:08Z TRACE swhkd] Other: Logitech G203 Prodigy Gaming Mouse
[2025-01-26T12:51:08Z DEBUG swhkd] Keyboard: Logitech G203 Prodigy Gaming Mouse Keyboard
[2025-01-26T12:51:08Z TRACE swhkd] Other: PC Speaker
[2025-01-26T12:51:08Z TRACE swhkd] Other: Eee PC WMI hotkeys
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=3
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=7
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=8
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=9
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=10
[2025-01-26T12:51:08Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=11
[2025-01-26T12:51:09Z TRACE swhkd] Other: HDA Intel PCH Rear Mic
[2025-01-26T12:51:09Z TRACE swhkd] Other: HDA Intel PCH Front Mic
[2025-01-26T12:51:09Z TRACE swhkd] Other: HDA Intel PCH Line
[2025-01-26T12:51:09Z TRACE swhkd] Other: HDA Intel PCH Line Out
[2025-01-26T12:51:09Z TRACE swhkd] Other: HDA Intel PCH Front Headphone
[2025-01-26T12:51:09Z DEBUG swhkd] Keyboard: keyd virtual keyboard
[2025-01-26T12:51:09Z TRACE swhkd] Other: keyd virtual pointer
[2025-01-26T12:51:09Z DEBUG swhkd] 5 Keyboard device(s) detected.
[2025-01-26T12:51:09Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2025-01-26T12:51:41Z TRACE swhkd] Other: Sleep Button
[2025-01-26T12:51:41Z TRACE swhkd] Other: Power Button
[2025-01-26T12:51:41Z TRACE swhkd] Other: Power Button
[2025-01-26T12:51:41Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-01-26T12:51:41Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard Consumer Control
[2025-01-26T12:51:41Z TRACE swhkd] Other: LIZHI 750-B IC USB Keyboard System Control
[2025-01-26T12:51:41Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-01-26T12:51:41Z TRACE swhkd] Other: Logitech G203 Prodigy Gaming Mouse
[2025-01-26T12:51:41Z DEBUG swhkd] Keyboard: Logitech G203 Prodigy Gaming Mouse Keyboard
[2025-01-26T12:51:41Z TRACE swhkd] Other: PC Speaker
[2025-01-26T12:51:41Z TRACE swhkd] Other: Eee PC WMI hotkeys
[2025-01-26T12:51:41Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=3
[2025-01-26T12:51:41Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=7
[2025-01-26T12:51:41Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=8
[2025-01-26T12:51:41Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=9
[2025-01-26T12:51:41Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=10
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=11
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA Intel PCH Rear Mic
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA Intel PCH Front Mic
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA Intel PCH Line
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA Intel PCH Line Out
[2025-01-26T12:51:42Z TRACE swhkd] Other: HDA Intel PCH Front Headphone
[2025-01-26T12:51:42Z DEBUG swhkd] Keyboard: keyd virtual keyboard
[2025-01-26T12:51:42Z TRACE swhkd] Other: keyd virtual pointer
[2025-01-26T12:51:42Z WARN swhkd] Received signal: 15
[2025-01-26T12:51:42Z WARN swhkd] Exiting...
Okay it definitely does look like a keyd error which means it has something to do with the uinput module
Will look into it
Any update on this issue?
@Letus252 is this issue still persisting? I am not able to reproduce this upon installation.
Which package did you install from AUR (bin or git)?
@Letus252 is this issue still persisting? I am not able to reproduce this upon installation.
Which package did you install from AUR (bin or git)?
Yup, the issue still persists. I installed bin version, I will uninstall it and test git version
@Letus252 is this issue still persisting? I am not able to reproduce this upon installation. Which package did you install from AUR (bin or git)?
Yup, the issue still persists. I installed bin version, I will uninstall it and test git version
I am not facing this issue on swhkd-bin either. However I did notice one thing, swhkd-bin by default tries to fetch /etc/swhkd/swhkdrc instead of ~/.config/swhkd/ one.
@Letus252 is this issue still persisting? I am not able to reproduce this upon installation. Which package did you install from AUR (bin or git)?
Yup, the issue still persists. I installed bin version, I will uninstall it and test git version
I am not facing this issue on swhkd-bin either. However I did notice one thing,
swhkd-binby default tries to fetch/etc/swhkd/swhkdrcinstead of~/.config/swhkd/one.
Switching to .git didn't change anything. Are you testing with keyd daemon active?
I have no idea if it matters, but this is the keyd config:
*
[main]
# Capslock to insert key
capslock = insert
# Insert key to capslock
insert = capslock
# Menu Key to F14
#compose = f14
# Create menu key layer (named 'test')
# which turns up arrow to ctrl+c etc.
compose = layer(test)
[test]
up = C-t
down = C-w
left = C-pageup
right = C-pagedown
@Letus252 is this issue still persisting? I am not able to reproduce this upon installation. Which package did you install from AUR (bin or git)?
Yup, the issue still persists. I installed bin version, I will uninstall it and test git version
I am not facing this issue on swhkd-bin either. However I did notice one thing,
swhkd-binby default tries to fetch/etc/swhkd/swhkdrcinstead of~/.config/swhkd/one.Switching to .git didn't change anything. Are you testing with keyd daemon active?
Yep i am doing that
I ran the following:
sudo systemctl enable --now keyd
./swhks
sudo ./swhkd -d
I am using the source which is swhkd-git so I believe it should work
I found something interesting, maybe you could use it:
- I stopped keyd
- Started swhkd (with no issue)
- Executed in another terminal
sleep 20; systemctl status keyd - Started keyd
- Keyboard froze
- Waited a bit
- Killed keyd (using panic sequence
Backspace + Escape+ Enter)
This is the keyd status while the keyboard was frozen:
● keyd.service - key remapping daemon
Loaded: loaded (/usr/lib/systemd/system/keyd.service; enabled; preset: disabled)
Active: active (running) since Sun 2025-03-23 20:17:25 CET; 12s ago
Invocation: 657a172a74c44b1eb6cf5277d90f9e35
Main PID: 3907 (keyd)
Tasks: 1 (limit: 18946)
Memory: 1.1M (peak: 2.5M)
CPU: 7ms
CGroup: /system.slice/keyd.service
└─3907 /usr/bin/keyd
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: match 0000:0000:faf03c86 /etc/keyd/default.conf (Eee PC WMI hotkeys)
Mar 23 20:17:25 Arch keyd[3907]: EVIOCGRAB: Device or resource busy
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: WARNING Failed to grab /dev/input/event8
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: ignoring 046d:c084:86188f17 (Logitech G203 Prodigy Gaming Mouse)
Mar 23 20:17:25 Arch keyd[3907]: EVIOCGRAB: Device or resource busy
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: WARNING Failed to grab /dev/input/event6
Mar 23 20:17:25 Arch keyd[3907]: EVIOCGRAB: Device or resource busy
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: WARNING Failed to grab /dev/input/event4
Mar 23 20:17:25 Arch keyd[3907]: EVIOCGRAB: Device or resource busy
Mar 23 20:17:25 Arch keyd[3907]: DEVICE: WARNING Failed to grab /dev/input/event3
[f0x@Arch ~]$
As you can see there are quite a few fails "Device or resource busy". I bet this is the issue.
And this is the terminal where swhkd is still active:
[sudo] password for f0x:
[2025-03-23T19:15:47Z TRACE swhkd] Logger initialized.
[2025-03-23T19:15:47Z DEBUG swhkd::perms] Setting EGID...
[2025-03-23T19:15:47Z DEBUG swhkd::perms] Setting EUID...
[2025-03-23T19:15:47Z DEBUG swhkd::perms] Setting initgroups...
[2025-03-23T19:15:47Z DEBUG swhkd] Wating for server to start...
[2025-03-23T19:15:47Z INFO swhkd] Env refreshed
[2025-03-23T19:15:47Z TRACE swhkd] Environment Aquired
[2025-03-23T19:15:47Z TRACE swhkd] Setting process umask.
[2025-03-23T19:15:47Z DEBUG swhkd] Using config file path: "/home/f0x/.config/swhkd/swhkdrc"
[2025-03-23T19:15:47Z TRACE swhkd] Attempting to find all keyboard file descriptors.
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA Intel PCH Front Headphone
[2025-03-23T19:15:47Z INFO swhkd] Env refreshed
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA Intel PCH Line Out
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA Intel PCH Line
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA Intel PCH Front Mic
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA Intel PCH Rear Mic
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=11
[2025-03-23T19:15:47Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=10
[2025-03-23T19:15:48Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=9
[2025-03-23T19:15:48Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=8
[2025-03-23T19:15:48Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=7
[2025-03-23T19:15:48Z TRACE swhkd] Other: HDA ATI HDMI HDMI/DP,pcm=3
[2025-03-23T19:15:48Z TRACE swhkd] Other: Eee PC WMI hotkeys
[2025-03-23T19:15:48Z TRACE swhkd] Other: PC Speaker
[2025-03-23T19:15:48Z DEBUG swhkd] Keyboard: Logitech G203 Prodigy Gaming Mouse Keyboard
[2025-03-23T19:15:48Z TRACE swhkd] Other: Logitech G203 Prodigy Gaming Mouse
[2025-03-23T19:15:48Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-03-23T19:15:48Z TRACE swhkd] Other: LIZHI 750-B IC USB Keyboard System Control
[2025-03-23T19:15:48Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard Consumer Control
[2025-03-23T19:15:48Z DEBUG swhkd] Keyboard: LIZHI 750-B IC USB Keyboard
[2025-03-23T19:15:48Z TRACE swhkd] Other: Power Button
[2025-03-23T19:15:48Z TRACE swhkd] Other: Power Button
[2025-03-23T19:15:48Z TRACE swhkd] Other: Sleep Button
[2025-03-23T19:15:48Z DEBUG swhkd] 4 Keyboard device(s) detected.
[2025-03-23T19:15:48Z ERROR swhkd] Could not open evdev device at /dev/input/mouse1: Inappropriate ioctl for device (os error 25)
[2025-03-23T19:15:48Z TRACE swhkd] Other: swhkd switches virtual output
[2025-03-23T19:16:14Z ERROR swhkd] Could not open evdev device at /dev/input/mouse2: Inappropriate ioctl for device (os error 25)
[2025-03-23T19:16:14Z ERROR swhkd] Could not open evdev device at /dev/input/js0: Invalid argument (os error 22)
[2025-03-23T19:16:14Z DEBUG swhkd] Keyboard: keyd virtual keyboard
[2025-03-23T19:16:14Z INFO swhkd] Device 'keyd virtual keyboard' at '/dev/input/event24' added.
[2025-03-23T19:16:14Z TRACE swhkd] Other: keyd virtual pointer
[2025-03-23T19:16:40Z INFO swhkd] Device 'keyd virtual keyboard' at '/dev/input/event24' removed
[2025-03-23T19:17:25Z ERROR swhkd] Could not open evdev device at /dev/input/mouse2: Inappropriate ioctl for device (os error 25)
[2025-03-23T19:17:25Z ERROR swhkd] Could not open evdev device at /dev/input/js0: Invalid argument (os error 22)
[2025-03-23T19:17:25Z DEBUG swhkd] Keyboard: keyd virtual keyboard
[2025-03-23T19:17:25Z INFO swhkd] Device 'keyd virtual keyboard' at '/dev/input/event24' added.
[2025-03-23T19:17:25Z TRACE swhkd] Other: keyd virtual pointer
[2025-03-23T19:18:15Z INFO swhkd] Device 'keyd virtual keyboard' at '/dev/input/event24' removed```
I have a feeling it's due to the ioctl errors. We really need to hunt it down @newtoallofthis123