# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0451:16a8 Texas Instruments, Inc. CC2531 ZigBee
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
# ls -al /dev/bus/usb/001/004
crw-rw-r-- 1 root root 189, 3 Jan 2 16:21 /dev/bus/usb/001/004
ls -al /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Jan 2 16:21 /dev/ttyACM0
so I added
lxc.cgroup.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/001/004 dev/bus/usb/001/004 none bind,optional,create=dir
lxc.cgroup.devices.allow: c 166:* rwm
lxc.mount.entry: /dev/ttyACM0 dev/ttyACM0 none bind,optional,create=file
to the config.
But in the container i get Error: Operation not permitted, cannot open /dev/ttyACM0, I've created dailout, used root, chmod 777 on /dev/ttyACM0 and privileged container.
But the USB Device is shown by lsusb inside the container.
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0451:16a8 Texas Instruments, Inc. CC2531 ZigBee
Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
When I try to add the device with lxc-device I get:
lxc-device add -n 100 /dev/ttyACM0 /dev/ttyACM0
lxc-device: 100: commands.c: lxc_cmd_add_bpf_device_cgroup: 1399 Operation not permitted - Failed to add new bpf device cgroup rule
lxc-device: 100: lxccontainer.c: add_remove_device_node: 4659 set_cgroup_item failed while adding the device node
lxc-device: 100: tools/lxc_device.c: main: 153 Failed to add /dev/ttyACM0 to 100
Could it be that the Kernel is missing a feature or something?
I followed this guide: https://forum.proxmox.com/threads/lxc-usb-passthrough-zwave-stick.30058/
On the Host the device shows up:
so I added
to the config.
But in the container i get
Error: Operation not permitted, cannot open /dev/ttyACM0
, I've created dailout, used root, chmod 777 on /dev/ttyACM0 and privileged container. But the USB Device is shown bylsusb
inside the container.When I try to add the device with lxc-device I get:
Could it be that the Kernel is missing a feature or something?
Edit: It should theoretically be possible to passthrough a tty with lxc on a raspberry pi: https://doc.turris.cz/doc/en/public/deconz_lxc_howto (Other os, other stick)
I also tried a USB to UART Stick, with the same result:
/dev/ttyUSB0: Operation not permitted