I just got through an adventure of a (seemingly) simple task of passing through a usb serial device to an lxc.
All my research pointed to the fact that I should have been able to (at least) passthrough the device to a running container in real time with the lxc-device add command.
Unfortunately that was not the case. I had to add the lxc.mount.entry lines into the container config file in order for the device to be passed through correctly and be usable.
The problem I see with this is that the usb device will change its location ( /dev/bus/usb/XXX/XXX ) even when it stays in the same usb port. On every connect/disconnect this has to be accounted for in order to capture the final device path even with a udev rule creating a symlink.
I had to resort to using a udev rule to create a symlink, set permissions (owner,group,mode), run a script to process the device, then the script gathers all the information needed to write the new lxc.mount.entry lines into the container config file and then start the container.
The only way (so far) to successfully passthrough a usb serial device to a container is to insure that the lxc.mount.entry lines exist in the config and they are correct.
If lxc-device add is indeed broken (since the lxc-device man page says that only "add" is supported right now) is proxmox pct able to do something similar or is it worth adding in the future? I looked at the pct man page and there does not seem to be an "add" like function with pct.
Right now I am successfully passing through upwards of 6 usb serial devices to their respective containers (grbl laser, grbl mill, 4 3d printers) and the reason this is a wanted feature is because sometimes not all 4 3d printers will be on and running at the same time. I may power 1 printer on and start using it through my print server container but if the container is already started I can't just add another printer I powered up. Even though my script processes the devices and gets all the information it can't add the lxc.mount.entry line to the config and have it be effective until the next container reboot.
I also can't add the lxc.mount.entry lines to the container config if they aren't powered up because the script checks for those devices first before changing the container config file.
All my research pointed to the fact that I should have been able to (at least) passthrough the device to a running container in real time with the lxc-device add command.
Unfortunately that was not the case. I had to add the lxc.mount.entry lines into the container config file in order for the device to be passed through correctly and be usable.
The problem I see with this is that the usb device will change its location ( /dev/bus/usb/XXX/XXX ) even when it stays in the same usb port. On every connect/disconnect this has to be accounted for in order to capture the final device path even with a udev rule creating a symlink.
I had to resort to using a udev rule to create a symlink, set permissions (owner,group,mode), run a script to process the device, then the script gathers all the information needed to write the new lxc.mount.entry lines into the container config file and then start the container.
The only way (so far) to successfully passthrough a usb serial device to a container is to insure that the lxc.mount.entry lines exist in the config and they are correct.
If lxc-device add is indeed broken (since the lxc-device man page says that only "add" is supported right now) is proxmox pct able to do something similar or is it worth adding in the future? I looked at the pct man page and there does not seem to be an "add" like function with pct.
Right now I am successfully passing through upwards of 6 usb serial devices to their respective containers (grbl laser, grbl mill, 4 3d printers) and the reason this is a wanted feature is because sometimes not all 4 3d printers will be on and running at the same time. I may power 1 printer on and start using it through my print server container but if the container is already started I can't just add another printer I powered up. Even though my script processes the devices and gets all the information it can't add the lxc.mount.entry line to the config and have it be effective until the next container reboot.
I also can't add the lxc.mount.entry lines to the container config if they aren't powered up because the script checks for those devices first before changing the container config file.