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

swhkd freezes keyboard upon execution #293

Open
Letus252 opened this issue Jan 26, 2025 · 7 comments
Open

swhkd freezes keyboard upon execution #293

Letus252 opened this issue Jan 26, 2025 · 7 comments
Assignees
Labels
Bug Something isn't working Component: daemon

Comments

@Letus252
Copy link

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.
@Shinyzenith
Copy link
Member

Shinyzenith commented Jan 26, 2025 via email

@newtoallofthis123
Copy link
Collaborator

That seems weird
Will look into it asap

@newtoallofthis123 newtoallofthis123 self-assigned this Jan 26, 2025
@newtoallofthis123 newtoallofthis123 added Bug Something isn't working Component: daemon labels Jan 26, 2025
@newtoallofthis123
Copy link
Collaborator

newtoallofthis123 commented Jan 26, 2025

@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 :)

@Letus252
Copy link
Author

Letus252 commented Jan 26, 2025

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 swhkd tries to use the config in your ~/.config directory that's stored in the XDG_CONFIG_HOME environment variable. However since pkexec doesn't pass-through all environment variables (such as XDG_CONFIG_HOME), swhkd falls back to a hardcoded path that is /etc/swhkd/swhkdrc

The second problem is that swhkd errors 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 that XDG_CONFIG_HOME is 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 place

sudo ln -sf ~/.config/swhkd/swhkdrc /etc/swhkd

@Letus252
Copy link
Author

Letus252 commented Jan 26, 2025

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).

@Letus252
Copy link
Author

Letus252 commented Jan 26, 2025

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...

@newtoallofthis123
Copy link
Collaborator

Okay it definitely does look like a keyd error which means it has something to do with the uinput module

Will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Component: daemon
Development

No branches or pull requests

4 participants