Greetings! I hit a little snag trying to pass a hot-pluggable USB device to an Incus container, and I’d appreciate any pointers.
Here’s what I’m working with:
- Debian 12 on the host with Incus 6.10.1
- Debian 12 in the container, privileged with nesting allowed
- Home Assistant Supervised in the container
- USB Zigbee dongle, SONOFF ZBDongle-E
This particular USB dongle presents a serial interface:
$ lsusb
Bus 001 Device 003: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 Mar 16 22:07 /dev/ttyUSB0
So far, I’ve added it as a unix-hotplug
device…
$ incus config device add homeassistant sonoff-zbdongle-e unix-hotplug required=false vendorid=10c4 productid=ea60
… and confirmed that the hotplug functionality is working. The container boots without the USB dongle installed. Plug in the dongle → /dev/ttyUSB0
appears in the container and functions as expected. Unplug the dongle → /dev/ttyUSB0
disappears from the container. So far so good.
The problem is that when the container starts or restarts with the USB dongle already plugged into the host, the container does not see the /dev/ttyUSB0
serial device. I assume this is because Incus reacts to uevents, and no uevents are generated when starting/restarting containers.
On the host, I am able to work around this by physically unplugging/replugging the dongle or resetting it in software…
$ usbreset 10c4:ea60
Resetting Sonoff Zigbee 3.0 USB Dongle Plus V2 ... ok
… which makes it appear in the container. How would one configure Incus to reset the USB device whenever the container starts? It seems that resetting host USB devices is prohibited in the container (for good reason) so it could not be done through /etc/rc.local
.
Thank you