htrefil / rkvm

Virtual KVM switch for Linux machines
MIT License
426 stars 51 forks source link

[issue] Running server kills all input #15

Open Aeny202 opened 3 years ago

Aeny202 commented 3 years ago

I have compiled the master branch with the instructions provided in readme.md. When I run ./server then it seems to start okay but my attached (Bluetooth) keyboards and mice stop registering keypresses and movement, except for the key to switch to another client and the laptop touchpad. Everything returns to normal once I kill the server.

Currently running up to date Arch install with Gnome 3.38.3 using Wayland.

beniwtv commented 3 years ago

Same on Manjaro, same Gnome version and Wayland. In journalctl one can see:

gnome-shell[2082]: Could not open device /dev/input/event270: GDBus.Error:System.Error.ENODEV: No such device

event270 definitively exists if I check it, and is the rkvm device, hence Gnome ignores all of the input. I believe it might be a timing issue, rvkm not having created the device yet as Gnome is asking for it, or something.

Tried to add some sleep statements on various places, but was unable to resolve this.

rmanne commented 3 years ago

Same on Arch, Swaywm+Wayland instead of Gnome. I tried various setups and from what I could figure out, sway-input returns something different after rkvm starts and before rkvm starts. I tried using the new inputs generated, like this:

input "1226:160:04CA00A0:00_04CA:00A0_Touchpad" {
    dwt enabled
    tap enabled
    natural_scroll enabled
    middle_emulation enabled
    scroll_factor 0.5
}
input "1:1:AT_Translated_Set_2_keyboard" {
    xkb_options caps:escape
    repeat_delay 125
    repeat_rate 40
}
# rkvm
#input "57005:57005:04CA00A0:00_04CA:00A0_Touchpad" {
#    dwt enabled
#    tap enabled
#    natural_scroll enabled
#    middle_emulation enabled
#    scroll_factor 0.5
#}
#input "57005:57005:AT_Translated_Set_2_keyboard" {
#    xkb_options caps:escape
#    repeat_delay 125
#    repeat_rate 40
#}

(commenting the first block and uncommenting the second) but I got the same kind of error message as @beniwtv:

00:00:00.151 [ERROR] [backend/session/logind.c:76] Failed to take device '/dev/input/event258': No such device

However, I don't think this is a timing issue. I set up a tmux session to watch 'ls -lah /dev/input > ...' and it looks like the input does already exist, and it even has the right permissions. But for some reason, sway isn't able to see it, or "take" it whatever that means.

rmanne commented 3 years ago

I tried adding myself to the input group and rebooted, and tried again, but it results in the same error message. It didn't seem to make the difference.

rmanne commented 3 years ago

Some additional logs, in case it helps figure out what the issue is.

Start rkvm server and swaymsg -t get_inputs (excerpt):

Input device: 04CA00A0:00 04CA:00A0 Touchpad
  Type: Touchpad
  Identifier: 57005:57005:04CA00A0:00_04CA:00A0_Touchpad
  Product ID: 57005
  Vendor ID: 57005
  Libinput Send Events: enabled

Input device: AT Translated Set 2 keyboard
  Type: Keyboard
  Identifier: 57005:57005:AT_Translated_Set_2_keyboard
  Product ID: 57005
  Vendor ID: 57005
  Active Keyboard Layout: English (US)
  Libinput Send Events: enabled

When this is run, the sway error logs:

00:08:54.876 [ERROR] [libinput] libevdev: BUG: Device "04CA00A0:00 04CA:00A0 Touchpad" received a double tracking ID -1 in slot 1.

00:08:56.162 [ERROR] [libinput] libevdev: BUG: Device "04CA00A0:00 04CA:00A0 Touchpad" received a double tracking ID 179 in slot 1.

00:08:56.570 [ERROR] [libinput] libevdev: BUG: Device "04CA00A0:00 04CA:00A0 Touchpad" received a double tracking ID -1 in slot 0.

Maybe is the issue related to this?

If the server is started and killed quickly:

00:14:02.072 [ERROR] [backend/session/logind.c:76] Failed to take device '/dev/input/event258': No such device
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
00:14:03.430 [ERROR] [libinput] libevdev: BUG: Device "04CA00A0:00 04CA:00A0 Touchpad" received a double tracking ID 362 in slot 0.

ls -lah /dev/input after the server is started:

crw-rw----  1 root input 13, 256 Feb 13 12:49 event256
crw-rw----  1 root input 13, 257 Feb 13 12:49 event257
crw-rw----  1 root input 13, 258 Feb 13 12:49 event258
rmanne commented 3 years ago

Small update, tried this on xorg as well, and while the keyboard works there, the trackpad remains not functional. On wayland, neither the keyboard nor the trackpad work.

trbn1 commented 3 years ago

This doesn't really seem like a race condition. I started rkvm-server from tty and at this point input on the server works and client connects just fine, then I started GDM (GNOME) service and all input on the server is lost.

marceloavilaoliveira commented 3 years ago

same issue here:

Could not open device /dev/input/event268: GDBus.Error:System.Error.ENODEV: No such device

Ubuntu 21.04 Kernel 5.11.0-18 Gnome 3.38.5 Wayland

afranke commented 3 years ago

Here’s another data point: it used to work on my Fedora 33. I reinstalled Fedora 34 over the old system and then reinstalled rkvm exactly how I had set it up previously. Now I am affected by this issue too.

ogost commented 2 years ago

Similar issue here: When server is started all input gets killed, and network interfaces shuts down. Only option to recover is unplugging power. Debian 11.3 Kernel 5.10.0-12 SwayWM 1.5-7 Wayland

BackThrowTheBaguetteBrawler commented 2 years ago

when i start a server, my thinkpad t530's trackpoint starts behaving like a normal mouse (no trackpoint scrolling) and the touchpad completely locks up upon killing the process all reverts to normal. with my setup, a keyboard-only mode would be a perfectly acceptable solution Ubuntu 20.04 Kernel 5.4.0-107 i3wm-regolith x11

erahhal commented 2 years ago

Same issue, using Sway/Wayland as server, and Xorg/i3 as client. Switching to the client, I can control the mouse and cursor on the client. Switching back, no control on the server. Have to SSH into the server and stop rkvm to use the mouse and keyboard again.

nicolasf commented 2 years ago

Same problem here on Wayland. My mouse doesn't work at all, and my trackpad is able to move the cursor but buttons don't work.

OS: Ubuntu 22.04.1 LTS x86_64 
Host: 20F9CTO1WW ThinkPad T460s 
Kernel: 5.15.0-47-generic 
Uptime: 5 days, 23 hours, 11 mins 
Packages: 2785 (dpkg), 24 (snap) 
Shell: bash 5.1.16 
Resolution: 1920x1080 
DE: GNOME 42.4 
WM: Mutter 
WM Theme: Adwaita 
Theme: Yaru-dark [GTK2/3] 
Icons: Yaru [GTK2/3] 
Terminal: x-terminal-emul 
CPU: Intel i5-6300U (4) @ 3.000GHz 
GPU: Intel Skylake GT2 [HD Graphics 520]
Memory: 13709MiB / 19738MiB 
bfsgr commented 2 years ago

I've managed to get it working by setting EV_KEY codes to a max of 565. Any values above that freeze all input. Although it can be some weird edge case in my machine, more people would need to validate this.

Just change glue::KEY_MAX to 565 to test it. https://github.com/htrefil/rkvm/blob/bf133665eb446d9f128d02e4440cc67bce50f666/input/src/linux/event_writer.rs#L93-L97

faassen commented 1 year ago

I had the same problem and can confirm that the suggestion by @bfsgr fixed it for me as well. Server is Fedora 36 with i3 on X11, client is Fedora 37 with Sway on Wayland.

gareylcuob commented 1 year ago

I had the same problem and can confirm that the suggestion by @bfsgr fixed it for me as well. Server is Fedora 36 with i3 on X11, client is Fedora 37 with Sway on Wayland.

@bfsgr suggestion resolves the server lockup behaviour but my client isn't responsive to server mouse or keyboard input once LeftCtrl+LeftAlt is pressed.

rkvm-server.service log confirms successful client authentication.

Both server and client are running on Fedora Workstation 38 with GNOME 44 Wayland.

Server HID:

nickbp commented 1 year ago

I was seeing this issue in Gnome 43.5 using Wayland. The 565 patch is needed on both client and server in order for both sides to be usable. Without the patch, everything seems to work in terms of events being captured and sent over the network, but events are not reflected in the window manager, making input appear dead on the target system (whether server or client).

After cranking up log levels via RUST_LOG=trace sudo -E rkvm-[client|server] ..., I could see the following behavior:

On my systems, the generated glue::KEY_MAX value is 767 and seems to come from here:

/usr/local/linux/input-event-codes.h
805:#define KEY_MAX         0x2ff

Maybe that's just the wrong value? I don't know what's special about 565.