Unexpected behaviour, USB device apperars in all LXC machines

saloiche

New Member
May 2, 2021
3
0
1
58
Hello, I am trying to redirect an USB Zwave stick to one of the LXC machines, but to my surprise as soon as I plug the USB device it is available through "lsusb" in all the LXC machines, even I do not need to restart all of them.

If I run the "lsusb" command in each machine, I get the same response in all the LXC machines:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 020: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I have tried to redirect the USB through the "/etc/pve/lxc/machineId.conf" adding the following lines and restarting the machine
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

but the problem persist.

The most important is that the Zwave stick does not works in the intended LXC machine where I redirect the USB stick.

I have looked for different forums, and there is consistent information in the way to redirect an USB, even an specific topic in the DomoticZ forum, the application I want to run, but no information regarding this unexpected behaviour.

All the LCX machines are running: debian-10.9.0-amd64-ntinst.iso images

Running Proxmox:
CPU(s)
4 x Intel(R) Celeron(R) CPU J3455 @ 1.50GHz (1 Socket)
Kernel Version
Linux 5.4.73-1-pve #1 SMP PVE 5.4.73-1 (Mon, 16 Nov 2020 10:52:16 +0100)
PVE Manager Version
pve-manager/6.3-2/22f57405
 
Hello, I am trying to redirect an USB Zwave stick to one of the LXC machines, but to my surprise as soon as I plug the USB device it is available through "lsusb" in all the LXC machines, even I do not need to restart all of them.

If I run the "lsusb" command in each machine, I get the same response in all the LXC machines:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 020: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


In containers you can always see the host devices but they can be accessed from inside the container only if it's allowed by a lxc.cgroup.devices.allow entry.
 
Thank you Richard!

I have routed the USB to the LXC container using "lxc.cgroup.devices.allow" in the "lxc_id.conf" file.

Then I have restarted the LXC machine and tested the USB device using "test -w /dev/ttyAM0 && echo success || echo failure" command on the LXC console and also in the Proxmox console.

For my surprise I got "success" both in the Proxmox console and in the LXC console, I tested it in other LXC machines inside the Proxmox machine and I got "failure", as I should expect.

How is it possible that the USB device responds both in Proxmox machine and in the LXC machine?
 
Thank you for the clarification Bob.

I would appreciatte if anyone could test a Zwave USB or similar device using the test command I describe above, inside and ouside of the LXC virtual machine.