LXC printer passtrough

mrdarkenrahl

New Member
Jul 20, 2021
2
0
1
31
Hello,
I want to use my old HP P1005 printer as CUPS network printer. I was able to passtrough device to LXC container and everything was working fine using this additonal lines in config:
Bash:
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/004/006 dev/bus/usb/004/006 none bind,optional,create=file

The problem is that the printer stopped to work after restart. I looked into host and I noticed, that this time printer was not under /dev/bus/usb/004/006, but /dev/bus/usb/004/002.
I wanted to use udev to create symlink, but it didn't worked (hp-setup was not able to find printer).
So I was trying to use:
Bash:
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/004/002 dev/bus/usb/004/006 none bind,optional,create=file
but this didn't worked. After changing to
Bash:
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/004/002 dev/bus/usb/004/002 none bind,optional,create=file
it finally started working.

Can someone explain it to me, why those paths have to be the same on host and guest? I was thinking, that path on guest can be different than on host. Second question - why it was not working with symlink? I expect, that this will be something similar, but first I'd like to understand, why names on host and quest have to be the same.

Tested on PVE 7.0-11.
 
Last edited: