Using a physical KVM switch with Unraid 6.9 destabilizes system


Recommended Posts

Hello-

 

I've been trying to use a physical KVM switch to move between both physical PCs and VMs running under UnRaid 6.9.  This has not proved to be successful (for the Unraid VM portion) -- to the point where simply trying to switch to an Unraid VM with the KVM can destabilize the entire system.

 

In the most innocuous case, the VM simply does not recognize the mouse and keyboard when the KVM switch is used.  To clear this problem, I must unmap and then remap USB devices from the VM for them to be recognized.  Sometimes I have to restart the VM to clear the issue.  Once cleared, the mouse and keyboard behave normally.

 

A more significant issue is when switching to the VM not only results in the keyboard and mouse not being recognized by the VM, but also the webgui of the Unraid server becoming unresponsive for 60-120 seconds.

 

The most significant issue is when switching to the VM not only results in the keyboard and mouse not being recognized by the VM, but the webgui reports it is no longer able to access the unraid OS thumb drive and the server must be either manually rebooted, or crashes.  This has occurred 3 times over the last 2 days of testing this.

 

Clearly, the KVM switch is causing something bad to happen within the USB management aspects of UnRaid.  Whether the KVM switch is uncleanly attaching/detaching the USB devices is not clear.  Weirdly, other USB devices (e.g., USB headset, USB Webcam) switch fine every time.  It's only the keyboard and mouse which seem to cause mischief.

 

I would be happy to help troubleshoot this more.

Link to comment

Does your KVM switch have dedicated keyboard and mouse connections?

The better KVM switches keep kb and mouse active on all connected systems. And prevent new USB detection each time you switch.

The same for monitor connections. A better KVM switch uses EDID emulation to keep each system informed about the attached monitor(s) and avoids display redetection while switching.

 

A VM in Unraid reads USB devices at start up and doesn’t expect them to change. There is a plugin available to work with dynamic USB devices, you can try that, but a different KVM switch could be a solution too.

 

Link to comment

My KVM does have dedicated mouse and kdb ports.  It also allegedly does EDID.  I've never had an issue with monitors not being in the "right place" when switching between devices.  That all being said, this is hardly the creme-de-la-creme of KVM devices.

 

I ran several tests and captured diagnostics.  I also made a timeline of what I was doing at what time.  Finally, I have a diagram of how things are physically connected up.

 

Hopefully this helps identify if I'm doing something wrong, or if there is an issue inside unraid usb handling.

 

mrs

KVM timeline skiserver-diagnostics-20220104-1151 -- KVM switch back and forth.zip kvm setup.pdf

Link to comment

Logs look normal for USB devices being disconnected and re-connected.

 

USB devices are Ennumerated when re connecting so the device number will no longer match the VM.

 

The USB_Manger plugin should be able to reconnect as will pickup the new device number. But you need to remove the mappings from the VM Template.

 

If you havent already I would suggest changing the USB Controller to otherwise you will only have 4 devices available on the USB2 controller and upto 14 on USB3.

 

image.png.d9b9a36395f21b72a798452272544d9e.png

 

The only reason of Unraid may have crashied before is because something caused the USB Boot drive to be disconnected.

Link to comment

Seems to be working now, Simon -- thanks.

 

I had to manually go into the VM xml interface to clean out all the residue of USB mappings.  Once I configured USB Manager, i had to restart the VM.  After doing that, for the first time I  successfully switched from the VM to the laptop and back again with no hangs.

 

Mark

Link to comment

Still seeing a few messages in the logs.  I also ran into some issues this morning that seemed to be associated with the built-in hub of a dell keyboard.  USB manager really did not like the hub, especially if I plugged the mouse into it.  When I connected the mouse directly to the KVM switch, USB Manager was much happier.  

 

Here's the latest log with a few errors in it -- not sure if these are anything to be concerned about:

 

Jan 5 11:39:37 SkiServer kernel: usb 1-2: USB disconnect, device number 103
Jan 5 11:39:37 SkiServer kernel: usb 1-2.1: USB disconnect, device number 104
Jan 5 11:39:37 SkiServer acpid: input device has been disconnected, fd 9
Jan 5 11:39:37 SkiServer kernel: usb 1-2.2: USB disconnect, device number 105
Jan 5 11:39:37 SkiServer kernel: usb 1-2.2.2: USB disconnect, device number 107
Jan 5 11:39:37 SkiServer kernel: usb 1-2.2.4: USB disconnect, device number 109
Jan 5 11:39:37 SkiServer kernel: usb 1-2.3: USB disconnect, device number 106
Jan 5 11:39:37 SkiServer kernel: usb 1-2.3.1: USB disconnect, device number 108
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/109 001 109
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Device Match 046d_HD_Pro_Webcam_C920_F1F9C06F vm: Mark Windows 10 001 109
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/108 001 108
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Device Match Logitech_USB_Receiver vm: Mark Windows 10 001 108
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/104 001 104
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/107 001 107
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Device Match C-Media_Electronics_Inc._USB_Audio_Device vm: Mark Windows 10 001 107
Jan 5 11:39:37 SkiServer usb_manager: usb_manager virsh called Mark Windows 10 1 109 Device detached successfully
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Disconnect 046d_HD_Pro_Webcam_C920_F1F9C06F vm: Mark Windows 10 running 001 109
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Removed 046d_HD_Pro_Webcam_C920_F1F9C06F vm: Mark Windows 10 running 001 109
Jan 5 11:39:37 SkiServer usb_manager: usb_manager virsh called Mark Windows 10 1 108 Device detached successfully
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Disconnect Logitech_USB_Receiver vm: Mark Windows 10 running 001 108
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Removed Logitech_USB_Receiver vm: Mark Windows 10 running 001 108
Jan 5 11:39:37 SkiServer usb_manager: usb_manager virsh called Mark Windows 10 1 107 error: Failed to open file '/tmp/libvirthotplugusbbybusMark Windows 10.xml': No such file or directory
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Disconnect C-Media_Electronics_Inc._USB_Audio_Device vm: Mark Windows 10 running 001 107
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Removed C-Media_Electronics_Inc._USB_Audio_Device vm: Mark Windows 10 running 001 107
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/106 001 106
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Device Match ASIX_Electronics_AX68004_00000001 vm: 001 106
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/105 001 105
Jan 5 11:39:37 SkiServer usb_manager: usb_manager virsh called 1 106 error: Failed to get option 'domain': Option argument is empty
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Disconnect ASIX_Electronics_AX68004_00000001 vm: nostate 001 106
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Removed ASIX_Electronics_AX68004_00000001 vm: nostate 001 106
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager usb_remove /dev/bus/usb/001/103 001 103
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Device Match 1a40_USB_2.0_Hub vm: 001 103
Jan 5 11:39:37 SkiServer usb_manager: usb_manager virsh called 1 103 error: Failed to get option 'domain': Option argument is empty
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Disconnect 1a40_USB_2.0_Hub vm: nostate 001 103
Jan 5 11:39:37 SkiServer usb_manager: Info: rc.usb_manager Removed 1a40_USB_2.0_Hub vm: nostate 001 103

 

Link to comment
39 minutes ago, M2Pilot said:

not sure if these are anything to be concerned about:

Will take a look, do you have a mapping for the HUB as passthrough of hubs is not support on QEMU. I have an enhancement to block this, but also to allow HUB processing which should be in the next version.

 

I think there is a fix for the domain option error already in the next release.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.