jails USB KVM switch and jails

I have a USB KVM switch so I can easily switch between multiple physical devices. The problem that I started running into was that since I have moved my 'workstation' to a jail, that after I switch to another physical device on the KVM, I cannot switch back to the workstation unless I restart Xorg.

I didn't have this problem before when my workstation was on the physical device and merely restarting Xorg solves the problem. If I ssh into the box remotely and kill Xorg, I can use the terminal just fine, but Xorg isn't happy.

Is there a way to resolve this?

Since I cannot consolidate the physical devices into a single one, that isn't an option. I am thinking that I could forego the USB KVM switch for a network one though that also gets tricky. My question is why does Xorg not complain when the USB device disappears and then reappears on a physical box whereas in a jail it does? I suspect there is something at play with devfs and dev unhiding even though it works fine in the terminal.

I listed the devices before and after toggling the KVM switch as well as after restarting Xorg and the devices are identical.
 
Last edited:
I disabled secure level within both the jail and host system and didn't see any change in behavior. I suspect it is something with devfs and the extra step of having to unhide the device which means it won't be available to Xorg.
 
Hmm, still bugs me:

I plugged in a keyboard without the USB KVM switch and that too does not work, so it has nothing to do with the switch and only running Xorg in a jail. This worked fine previously outside of a jail.

Code:
ugen0.3: <Dell Dell USB Keyboard> at usbus0
ukbd1 on uhub0
ukbd1: <Dell Dell USB Keyboard, class 0/0, rev 1.10/3.01, addr 2> on usbus0
kbd3 at ukbd1
ugen0.3: <Dell Dell USB Keyboard> at usbus0 (disconnected)
ukbd1: at uhub0, port 1, addr 2 (disconnected)
ukbd1: detached

I plugged in the keyboard, tried typing, and then removed it. As soon as I exit Xorg, the device works. Xorg only appears to see what devices are available at the time it starts. Additionally, I see it is listed as /dev/input/event7 and upon removing the device, that node disappears. Checking the Xorg logs, I don't see that device being detected as it seems the detection only runs at the start of the Xorg session.

Hmm, I came across an article on Arch Linux from 2008 about dbus and hotplug and am wondering if that could be the issue. Dbus is running, but I wonder if there is some interaction with dbus and jails that is breaking.

 
I tested this again directly on the host system and was able to hotplug the keyboard and mouse as I expected. The logs from the base system were indicating that the device was added by config/udev for /dev/input/event6.

On the jailed system, tailing /var/log/Xorg.0.log, there is nothing in the log when I plug or remove the mouse.

This is my relevant devfs.rules:

Code:
[jail_devfs=10]
add path 'dri*' unhide
add path 'drm*' unhide
add path 'dsp*' unhide
add path 'mixer*' unhide

add path 'speaker*' mode 0660 group operator unhide

# USB drives
add path 'da*' unhide

# USB HID
add path 'ums*' unhide
add path 'input/event/*' unhide

# ZFS
add path 'zfs' unhide

add path 'ada2*' unhide
 
I still need some help. If I understand correctly, because this is running in a jail, it does not have any control over the its own /dev. The host controls that. Does Xorg need to create any devices under /dev for it to work? If so, then this will never work as expected.
 
Back
Top