LXC container no USB input (passthrough) in container GUI (GBM)

devilrunner

Renowned Member
Aug 3, 2015
26
6
68
I am running Kodi (LibreELEC) in an unprivileged LXC container with GPU+USB passthrough - see below config.

Code:
#Converted from VM to CT via <a href=http%3A//www.github.com/thushan/proxmox-vm-to-ct>proxmox-vm-to-ct</a>.
#
#http%3A//libreelec-test2%3A8080/
arch: amd64
cmode: console
cores: 2
dev0: /dev/dri/card0
dev1: /dev/dri/renderD128
dev2: /dev/fb0
dev3: /dev/input/event2
features: keyctl=1,nesting=1
hostname: LibreELEC-test2
memory: 2048
net0: name=eth0,bridge=vmbr0,hwaddr=BC:24:11:4E:5E:94,ip=dhcp,type=veth
onboot: 0
ostype: unmanaged
rootfs: local-zfs:subvol-103-disk-0,size=20G
swap: 512
unprivileged: 1
lxc.mount.auto: sys:rw

The container boots fine and outputs the Kodi interface or GUI on the connected HDMI monitor. As a bonus I can even use hardware acceleration.
However the USB Keyboard nor Mouse input seems to be working or controlling the GUI.

I checked a couple of things in the container;

Code:
LibreELEC-test2:~ # ls /dev/input -la
crw-rw----    1 root     root       13,  66 Oct 17 16:26 event2

Code:
LibreELEC-test2:~ # evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event2:      Lite-On Technology USB Productivity Option Keyboard( has the hub in # 1 )
Code:
Testing ... (interrupt to exit)
Event: time 1760711288.223959, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70052
Event: time 1760711288.223959, type 1 (EV_KEY), code 103 (KEY_UP), value 1
Event: time 1760711288.223959, -------------- SYN_REPORT ------------
Event: time 1760711288.263947, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70052
Event: time 1760711288.263947, type 1 (EV_KEY), code 103 (KEY_UP), value 0
Event: time 1760711288.263947, -------------- SYN_REPORT ------------

So the /dev/input device does seem to be working in the container.

I suspect as the container OS is using GBM there might be some permissions missing still ?
Should I give the container access to /run/udev, and how?


Sources;
 
/dev/input/* usually has group input (instead of root). Find out what the number of the input group inside the container is and change

into dev3: /dev/input/event2,gid=NUMBER-OF-THE-INPUT-GROUP,uid=0 (or use the Proxmox web GUI to set the group number).

I ran the below on the host :

Code:
root@pve:~# pct exec 103 getent group video render tty input audio
video:x:39:pipewire
render:x:105:
tty:x:5:
input:x:104:
audio:x:63:pipewire

Changed the LXC config line:
dev3: /dev/input/event2,gid=104,uid=0
Resulting inside the container:
Code:
LibreELEC-test2:~ # ls /dev/input -la
crw-rw----    1 root     input      13,  66 Oct 18 18:18 event2


However still not able to control the GUI whatsoever. Any more ideas?

PS: Are you from Belgium by any change?
 
I justed wanted to update that I managed to get LibreELEC working inside a privileged LXC container.

below is the proxmox conf I am using;

Code:
arch: arm64
cores: 2
hostname: LibreELEC-RK3588.aarch64-12.90.1
memory: 512
net0: name=eth0,bridge=vmbr0,hwaddr=BC:24:11:4D:A3:FF,ip=dhcp,ip6=dhcp,tag=10,type=veth
ostype: unmanaged
rootfs: local-zfs:subvol-10555-disk-0,size=8G
swap: 512
lxc.apparmor.profile: unconfined
lxc.cap.drop:
lxc.mount.auto: proc:rw sys:rw
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.cgroup2.devices.allow: c 13:* rwm
lxc.mount.entry: /dev/bus/usb dev/bus/usb none bind,optional,create=dir
lxc.mount.entry: /dev/input dev/input none bind,optional,create=dir
lxc.cgroup2.devices.allow: c 226:* rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
lxc.cgroup2.devices.allow: c 116:* rwm
lxc.mount.entry: /dev/snd dev/snd none bind,optional,create=dir

It's running on;
- NanoPi R6S (Arm64)
- proxmox-ve: 9.0.0 (running kernel: 6.18.9-current-rockchip64) (Armbian kernel)
- pve-manager: 9.0.10-2 (running version: 9.0.10-2/74d1bcc54a6e6730) (PxVirt port)
 
Last edited: