How to USB passthrough into an unpriviledged LXC with the UI in 8.2?

XabiX

Active Member
Nov 8, 2017
21
1
43
46
Hello Team,

I read another thread on this issue and discovered that now we can easily passthrough a USB device in a CT with: Resources tab with Add > Device passthrough.

Here is the device, I am trying to pass:
Code:
root@Proxmox ~# lsusb
Bus 004 Device 002: ID 18d1:9302 Google Inc.
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 1a86:55d4 QinHeng Electronics SONOFF Zigbee 3.0 USB Dongle Plus V2
Bus 003 Device 003: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 003 Device 006: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 1462:7c94 Micro Star International MYSTIC LIGHT
Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 003: ID 0463:ffff MGE UPS Systems UPS
Bus 001 Device 005: ID 046d:c01b Logitech, Inc. MX310 Optical Mouse
Bus 001 Device 004: ID 413c:2003 Dell Computer Corp. Keyboard SK-8115
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@Proxmox ~# ls -al /dev/bus/usb/003/003
crw-rw-r-- 1 root root 189, 258  1 juil. 08:53 /dev/bus/usb/003/003
root@Proxmox ~# stat /dev/bus/usb/003/003
  Fichier : /dev/bus/usb/003/003
   Taille : 0           Blocs : 0          Blocs d'E/S : 4096   fichier spécial de caractères
Périphérique : 0/5      Inœud : 530         Liens : 1     Type de périph. : 189,258
Accès : (0664/crw-rw-r--)  UID : (    0/    root)   GID : (    0/    root)
 Accès : 2024-07-01 08:53:31.856249813 +0200
Modif. : 2024-07-01 08:53:31.856249813 +0200
Changt : 2024-07-01 08:53:31.856249813 +0200
  Créé : 2024-07-01 08:53:24.753249746 +0200

On the LXC CT, I see an issue with the Uid/Gid. I did try with 0 and 0 too but he didn't seem to work neither:
Code:
root@Jeedom:~# ls -l /dev/
crw-rw-rw- 1 nobody nogroup   5, 0 Jul  1 06:53 tty
crw--w---- 1 root   tty     136, 1 Jul  2 07:50 tty1
crw--w---- 1 root   tty     136, 2 Jul  2 07:50 tty2

root@Jeedom:~# stat /dev/bus/usb/003/003
  File: /dev/bus/usb/003/003
  Size: 0               Blocks: 0          IO Block: 4096   character special file
Device: 32h/50d Inode: 6           Links: 1     Device type: bd,102
Access: (0666/crw-rw-rw-)  Uid: (  189/ UNKNOWN)   Gid: (  258/ UNKNOWN)
Access: 2024-07-02 07:50:21.359331205 +0000
Modify: 2024-07-02 07:50:21.359331205 +0000
Change: 2024-07-02 07:50:21.359331205 +0000
 Birth: 2024-07-02 07:50:21.359331205 +0000

or with O/0:
Code:
root@Jeedom:~# stat /dev/bus/usb/003/003
  File: /dev/bus/usb/003/003
  Size: 0               Blocks: 0          IO Block: 4096   character special file
Device: 32h/50d Inode: 6           Links: 1     Device type: bd,102
Access: (0666/crw-rw-rw-)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2024-07-02 08:23:54.180866147 +0000
Modify: 2024-07-02 08:23:54.180866147 +0000
Change: 2024-07-02 08:23:54.180866147 +0000
 Birth: 2024-07-02 08:23:54.180866147 +0000

Thank you for your help and feedbacks
 

Attachments

  • Screenshot 2024-07-02 at 10.18.49.png
    Screenshot 2024-07-02 at 10.18.49.png
    17.1 KB · Views: 41
Last edited:
You need to set your usb device in mode 0666.
Create a rules-File (/etc/udev/rules.d/99-usb-serial.rules) with your specific device attributes.

For example with the following:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8" SYMLINK+="ttyZIGBEE0", MODE="0666"

You can get that attributes with: udevadm info /dev/bus/usb/003/003
ID_MODEL_ID = idProduct
ID_VENDOR_ID = idVendor
After that run: udevadm trigger
There should be a new device (for me: /dev/ttyZIGBEE0) under /dev.

Now you can add your device to the lxc with:
path: /dev/ttyZIGBEE0
uid in ct: 0
gid in ct: 0
access mode: 0666

Best regards
thomas
 
  • Like
Reactions: XabiX