LXC USB Passthrough hotplug permission problem

Malloy

New Member
Dec 27, 2020
2
0
1
35
Hello,

my home automation runs in an unprivileged LXC container. Client devices are controlled via a Zigbee USB stick.
I have a udev rule with:
"SUBSYSTEMS=="usb", ATTRS{idVendor}=="1cf1", ATTRS{idProduct}=="0030", MODE="0666", GROUP="dialout", SYMLINK+="CONBEE"
and in the config:
lxc.cgroup.devices.allow: c 166:* rwm
lxc.mount.entry: /dev/CONBEE dev/CONBEE none bind,optional,create=file

This works fine for some hours but after some time the usb stick resets itself and is recognised as a new USB device. Due to the udev rule the permissions are set properly on the host, but in the container I get:
c--------- 0 nobody nogroup 189, 4 Dec 26 23:01 /dev/CONBEE

After rebooting the container the usb device works again.
Is there a solution to not reboot the container after some hours? Or should I use a privileged container instead?
 
hi,

does it not work if you set the owner of /dev/CONBEE to 100000?
please try running: chown 100000:100000 /dev/CONBEE from your node. afterwards if you check in the container you should see root:root instead of nobody:nogroup
 
The chown 100000:100000 /dev/CONBEE executed on the node has no effect on the device in the running container. This is only applied after restarting it. Inside the privileged container I can do a chown and chmod, but in the unprivileged I do not have the permissions to do that.
 
Last edited:
Hello Mallow

Did you find a fix? I am having dealing with this exact issue. Restarting the container manually everytime is not ideal :(