LXC USB Printer Server

Giggling3999

Member
Apr 2, 2024
85
3
8
Hi

I'm trying to set up a LXC print/scan container - But I have a problem

I have an LXC - I pass through the device via /dev/bus/usb/005/105 etc

The usb number changes each time that I turn on the printer - I am also unsure if there WAS some way to dynamically map it , does an LXC allow for the device to be passed on creation? i.e. without rebooting the LXC

Is a VM the only way to achieve this?
 
I'll let the experts chime in with specific information, but you might be able to setup udev rules on the host to map the printer to a specific path. Try some searches for udev usb printer mapping, or maybe someone later can provide specific information.
 
Thanks for the input - I'll have a look around

Tearing my bloody hair out trying to get the damn printer to work with usb in the first place!
 
So - I came up with a udev rule that symlink a /dev/printer - I also saw a solution of passing a /dev/serial - But this folder does not exist for me

Code:
nano /etc/udev/rules.d/98-printer.rules

SUBSYSTEMS=="usb", ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="02ce", SYMLINK+="printer", MODE="0777"

I then modify the LXC

Code:
nano /etc/pve/lxc/109.conf 

dev0: /dev/printer,mode=0777

This APPEARS to work - I can see it in the LXC - However - There is IO issues and it can't print/scan - Any help appreciated
Code:
 lsusb

Bus 005 Device 031: ID 04f9:02ce Brother Industries, Ltd DCP-7055W

ls -la /dev

crwxrwxrwx  1 root   root   189, 542 Apr 24 07:03 printer

sane-find scanner

could not open USB device 0x04f9/0x02ce at 005:031: No such device (it may have been disconnected)
 
The problem appears to be that even though it is passed correctly, it is still expecting the bus and device location 005:031 in the above.

If I manually map it to that location - No problem - The problem is doing that - Dynamically