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

KBCT crashes after system being suspended #15

Open
mzenz opened this issue Dec 29, 2021 · 5 comments · May be fixed by #45
Open

KBCT crashes after system being suspended #15

mzenz opened this issue Dec 29, 2021 · 5 comments · May be fixed by #45

Comments

@mzenz
Copy link

mzenz commented Dec 29, 2021

First of all, thanks so much for this life-saving project, it really saved the day for me. Let me know if you need any extra info, happy to dig deeper! =)

Description:

KBCT crashes after system is suspended and resumed.

Command (running as root):

$ /usr/local/bin/kbct remap --config /etc/kbct/config.yml

Configuration

Disable PageUp & PageDown keys altogether:

- keyboards: [ "AT Translated Set 2 keyboard"]
  keymap:
    pageup: reserved
    pagedown: reserved

Log output

 INFO  kbct > Starting kbct event loop, pid=7319
 INFO  kbct > Capturing device path=/dev/input/event2 name="AT Translated Set 2 keyboard" mapped_name="Kbct-AT Translated Set 2 keyboard"
Error: IOError(Os { code: 4, kind: Interrupted, message: "Interrupted system call" })

System info

OS: Ubuntu 21.10 x86_64 
Host: XPS 13 9310 2-in-1 
Kernel: 5.13.0-22-generic 
Uptime: 15 mins 
Packages: 1783 (dpkg), 17 (snap) 
Shell: fish 3.1.2 
Resolution: 3840x2400 
WM: Mutter 
Terminal: terminator 
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz 
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] 
Memory: 5074MiB / 31819MiB 
@samvel1024
Copy link
Owner

Thank you @mzenz for the detailed report. Can you please repeat the same scenario with RUST_BACKTRACE env var set to 1 and provide the backtrace of the error.

export RUST_BACKTRACE=1 
sudo -E /usr/local/bin/kbct remap --config /etc/kbct/config.yml

@mzenz
Copy link
Author

mzenz commented Dec 31, 2021

Even with that variable set as you describe, I get the exact same output as far as I can tell:

 INFO  kbct > Starting kbct event loop, pid=5939
 INFO  kbct > Capturing device path=/dev/input/event2 name="AT Translated Set 2 keyboard" mapped_name="Kbct-AT Translated Set 2 keyboard"
Error: IOError(Os { code: 4, kind: Interrupted, message: "Interrupted system call" })

Below is the output I get if I attach gdb to the process and then repro the bug:

$ gdb --args /usr/local/bin/kbct remap --config /etc/kbct/config.yml

GNU gdb (Ubuntu 11.1-0ubuntu2) 11.1
This GDB was configured as "x86_64-linux-gnu".
(gdb) run
Starting program: /usr/local/bin/kbct remap --config /etc/kbct/config.yml
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7c5f640 (LWP 9254)]
 INFO  kbct > Starting kbct event loop, pid=9163
[Thread 0x7ffff7c5f640 (LWP 9254) exited]
 INFO  kbct > Capturing device path=/dev/input/event2 name="AT Translated Set 2 keyboard" mapped_name="Kbct-AT Translated Set 2 keyboard"
Error: IOError(Os { code: 4, kind: Interrupted, message: "Interrupted system call" })
[Inferior 1 (process 9163) exited with code 01]

@jerry-sky
Copy link

I’ve also stumbled upon this issue. I come with no further information, as I receive the same logs when suspending the computer whilst running KBCT.

However, I wanted to bump this issue and ask whether there are any updates on this?

@mzenz
Copy link
Author

mzenz commented Apr 13, 2022

@jerry-sky my solution was to just have KBCT run as a service via systemctl and configure it to restart automatically if it ends/crashes:

First create the service config file @ /usr/lib/systemd/system/kbct.service with the following content:

[Unit]
Description=KBCT key mapper

[Service]
User=root
WorkingDirectory=/usr/local/bin
ExecStart=kbct remap --config /etc/kbct/config.yml
Restart=always

[Install]
WantedBy=multi-user.target

Then enable KBCT to run at system start:

sudo systemctl enable kbct.service

This assumes that the KCBT executable is installed in /usr/local/bin, your location might vary.

@seltzered
Copy link
Contributor

FWIW, I just started noticing this issue occurring much more after switching from Ubuntu 21.10 to 22.04 (Wayland on both installs), tried running with RUST_BACKTRACE=1 and similarly only got Error: IOError(Os { code: 4, kind: Interrupted, message: "Interrupted system call" }).

While I do have kbct setup to run at system start I haven't considered auto-restart yet like the above comment. My workaround so far has been to just keep a restart_kbct.sh script that can easily be invoked from a launcher tool (e.g. pkexec /path/to/kbct remap --config /path/to/my/config.yaml &)

@herlev herlev linked a pull request Oct 27, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants