Passthrough USB to LXC permanently by udev symlink

TutenStain

Active Member
Jan 25, 2017
3
0
41
32
Hello,
I want to passthrough my APC UPS to my privileged container for monitoring using apcupsd. I have successfully passed it trough but the issue I am attempting to solve is that I have passed it through using a bus path which changes if I reconnect the ups for example, leading to manual intervention at times as I need to update the path. I thought that creating an udev rule with symlink might solve it but I am running into issues.

udev rule which symlinks it to /dev/ups1:
SUBSYSTEM=="usb", DRIVER=="usb", ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0003", ATTRS{serial}=="xxxxxx", SYMLINK+="ups1"

lxc config which works and apcupsd correctly connects in the container if the UPS happens to be identified as bus 002/010, but fails to establish a connection if the path changes.
lxc.cgroup2.devices.allow: c 189:* rwm lxc.mount.entry: /dev/ups1 dev/bus/usb/002/010 none bind,optional,create=file

If the UPS happens to be for example at /dev/bus/usb/001/011 for example (i.e. not as configured), apcupsd fails to connect to the UPS. Any idea why? I thought I freely was able to choose mount path in the container?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!