USB printer to LXC container

humpbackwhale621

New Member
Mar 6, 2024
3
0
1
Hi, I can't seem to figure out how to get my USB printer working in the LXC container. I've seen bits of information scattered around, and tried to recreate from those, but hasn't gotten it working so far.

I have a privileged container (tried before with unprivileged) and Samsung ML-2010P printer.
On the host the printer shows up with

Code:
~# lsusb -vvv
Bus 003 Device 002: ID 04e8:326c Samsung Electronics Co., Ltd ML-2010P Mono Laser Printer

ls /dev/bus/usb/003/002 -l
crw-rw-r-- 1 root lp 189, 257 Mar  6 18:41 /dev/bus/usb/003/002

~# nano /etc/pve/lxc/104.conf has
lxc.cgroup2.devices.allow: c 189:* rwm
lxc.mount.entry: /dev/bus/usb/003/002 dev/bus/usb/003/002 none, bind,optional,create=dir

I also tried creating a udev rule, which I don't really understand what it's about:
Code:
~# nano /etc/udev/rules.d/50-myusb.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="326c", MODE="0666", GROUP="lp"



Rebooting the container this is what I get

Code:
~# lsusb -vvv
Bus 003 Device 002: ID 04e8:326c Samsung Electronics Co., Ltd ML-2010P Mono Laser Printer
Couldn't open device, some information will be missing

~# ls -la /dev/bus/usb/003/002
total 0
drwxr-xr-x 2 root root 40 Mar  6 17:44 .
drwxr-xr-x 3 root root 60 Mar  6 17:44 ..

~# lpinfo -v
file cups-brf:/
network beh
network ipps
network ipp
network socket
network lpd
network http
network https

Where am I going wrong, any ideas?
 
Are you able to print from the host?
If so, see if you can share the printer with Samba and print with CUPS
 
I haven't tried printing from the host. Don't even think I have cups or the printer driver installed there.
Doesn't it beat the purpose of using containers or VMs to begin with?

Either way, I'll have a go at printing from the host
 
Should be: '...,create=file'
As you could see with your 'ls'-Command there was a directory with the devicefiles name created,
not a bind mount of the file itself. 'lsusb' still partially worked because of the containers standard bindings.
This was exactly what I was missing. Container found the printer, printing works like a charm. I'm sure I had ,create=file in my config earlier on, but had something else wrong at that time. And then while troubleshooting and trying different options I changed it.
Thanks for your help MLO!
 

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!