LXC USB Passthrough
Passing through a USB device with LXC allows your LXC guest access to a physical USB device plugged into the host system.
The information on this page is written for a host running Proxmox but should be easy to adapt to any machine running LXC/LXD.
root@vault:~# lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 13d3:3273 IMC Networks 802.11 n/g/b Wireless LAN USB Mini-Card Bus 001 Device 004: ID 10c4:8a2a Silicon Labs HubZ Smart Home Controller Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Determine Device Major/Minor Numbers
root@vault:~# ls -l /dev/bus/usb/001/004 crw-rw-r-- 1 root root 189, 3 Oct 3 17:17 /dev/bus/usb/001/004
From that you can see the major device number is
189 and the minor is
Provide LXC Access
In the configuration file you'd then add lines to allow the LXC guest access to that device and then also bind mount the devices from the host into the guest. In the example above since both devices share the same major number it is possible to use a shorthand notation of
189:* to represent all minor numbers with major number
# /etc/pve/lxc/*.conf + lxc.cgroup.devices.allow: c 189:* rwm + lxc.mount.entry: /dev/bus/usb/001/020 dev/bus/usb/001/020 none bind,optional,create=file,mode=664
unprivileged Containers Access