USB devices to LXC, but every reboot/ reconnect new DeviceNr

Bytechanger

Member
Jan 19, 2022
41
1
13
47
Hi,

I want to setup my home automation.
I put on my proxmox an active usb-hub. There are some USB-Dongles.
lsub get the usb-Bus Nr and Device ID.
Set the config to transfer all needed USB-Devices to LXC.

But every reboot of the proxmox or reconnect, connect new device, etc. the Device Number on proxmox changes...
Somtimes it is Bus 001, Device 004, other times Bus 001, Device 074, and so on...

Is there a way to put the Device ID to the LXC ???

Greets

Byte
 
hi,

you can write a udev rule for your device.



get the vendor and product id of your device:
Code:
udevadm info --name=/dev/bus/usb/001/001 --attribute-walk | grep -E 'vendor|product'
    ATTR{idProduct}=="0002"
    ATTR{idVendor}=="1d6b"
    ATTR{product}=="xHCI Host Controller"
    ATTRS{subsystem_vendor}=="0x1b21"
    ATTRS{vendor}=="0x1022"
    ATTRS{subsystem_vendor}=="0x1022"
    ATTRS{vendor}=="0x1022"


then you add a rule file in /etc/udev/rules.d/ directory

Code:
ACTION=="add", ATTRS{idVendor}=="1022", ATTRS{idProduct}=="0002", SYMLINK+="my_cool_usb"

hope this helps!
 
How does that help?

Even if you set a udev rule, the LxC container won't be able to resolve the symlink and therefore won't recognize the device.

Like here. What am I missing?