LXC USB Print Server

davetodd

New Member
May 17, 2024
6
1
3
Hello all, my first post. I have been searching the internet for days to solve this but cannot. My post should display the amount I have tried myself before reaching out for help.

I have a Proxmox VE host/node. For simplicity purposes I just want a single LXC container that has a working USB printer, that can then be shared across the entire network.
Getting the USB port shared across is the problem.

Proxmox host: pve-manager/8.2.2/9355359cd7afbae4
container template: ubuntu-24.04-standard_24.04-2_amd64.tar.zst
Printer : Brother HL-2130

On the Proxmox Host:

lsusb : Bus 003 Device 002: ID 04f9:003f Brother Industries, Ltd HL-2130 series
ls /dev/bus/usb/003/002 -l : crw-rw-r-- 1 root lp 189, 257 May 17 11:13 /dev/bus/usb/003/002
nano /etc/pve/lxc/101.conf
+ lxc.cgroup.devices.allow: c 189:257 rwm
+ lxc.mount.entry: /dev/bus/usb/003/002 dev/bus/usb/003/002 none bind,optional,create=file

save file, and reboot container.

On the LXC container :
lsusb : Bus 003 Device 002: ID 04f9:003f Brother Industries, Ltd HL-2130 series
ls /dev/bus/usb/003/002 -l : crw-rw-r-- 1 nobody nogroup 189, 257 May 17 03:13 /dev/bus/usb/003/002

The container printer drivers dont test print, and i notice that the owner group and user are nobody and nogroup
I have no idea what to do now.

Any thoughts or suggestions?
 
Last edited:
You need to load the drivers on the Proxmox host when using a container. And then pass the dev-nodes that are created by the driver via the new Add Device Passthrough (web GUI, container, Resources) to the container. Note that hotplug/unplug does not work in a container, so maybe using a VM is the easiest solution.
 
At the time, I just installed the exact same printer on the PVE host with CUPS & its shared on my network. Its of the few things I have on the server itself. I do try not to make any major changes to the PVE host - but sometimes its just so much easier.
 
You need to load the drivers on the Proxmox host when using a container. And then pass the dev-nodes that are created by the driver via the new Add Device Passthrough (web GUI, container, Resources) to the container. Note that hotplug/unplug does not work in a container, so maybe using a VM is the easiest solution.
OK this is new information that i will look into, thanks for helping!
 
At the time, I just installed the exact same printer on the PVE host with CUPS & its shared on my network. Its of the few things I have on the server itself. I do try not to make any major changes to the PVE host - but sometimes its just so much easier.
While i understand this, and really understand "so much easier", i would go a full VM before putting this on the host. Part of this exercise is learning the system, so easier is not my desire, right is my desire, and learning to "do it right"
 
I installed the drivers on the host. I was using the Brother web page drivers, some of the log talked about "lpadmin: Printer drivers are deprecated and will stop working in a future version of CUPS".
A friend suggested i use "apt install printer-driver-gutenprint" for drivers instead, but i do not believe it supports Brother drivers.
I put them on both the Proxmox host and the LXC for good luck

I quickly looked into "then pass the dev-nodes that are created by the driver via the new Add Device Passthrough (web GUI, container, Resources) to the container." idea but realised i had no idea what to add here. It is my next port of call.

I took the above advice and used lxc.cgroup2.devices.allow: c 189:* rwm in /etc/pve/lxc/101.conf

I have the same results in both the host and LXC when i type lsusb : Bus 003 Device 002: ID 04f9:003f Brother Industries, Ltd HL-2130 series

When i go to printerServer:631/admin/ (cups admin web page) i see no installed printer, and when i go to add one, there is nothing resembling my printer available in Local Printers.

This does not seem as straight forward as passing a port to a VM, so i feel that i am missing something.
Where do i find more information about what parameters i pass to the new Add Device Passthrough (web GUI, container, Resources)?
 
Last edited:
This does not seem as straight forward as passing a port to a VM, so i feel that i am missing something.
It is not straight forward and (un)plug also does not work with a container. It's no fun passing USB to containers but you wanted to try and learn anyway.
Where do i find more information about what parameters i pass to the new Add Device Passthrough (web GUI, container, Resources)?
Look at all the dev-node (files and directories in /dev with ls -lR /dev) without the printer plugged in. Then plug it in (with drivers installed/enabled) and look at all dev-nodes again. You need to pass all the new dev-nodes (with their directories) to the container using the Add Device Passthrough button. And use the corresponding group ID for the same group inside the container as you see on the Proxmox host.

Here is an example from the container configuration file for my TV-tuner (passe to a container):
Code:
dev0: /dev/dvb/adapter0/demux0,gid=44,uid=0
dev1: /dev/dvb/adapter0/dvr0,gid=44,uid=0
dev2: /dev/dvb/adapter0/frontend0,gid=44,uid=0
dev3: /dev/dvb/adapter0/net0,gid=44,uid=0
dev4: /dev/dvb/adapter1/demux0,gid=44,uid=0
dev5: /dev/dvb/adapter1/dvr0,gid=44,uid=0
dev6: /dev/dvb/adapter1/frontend0,gid=44,uid=0
dev7: /dev/dvb/adapter1/net0,gid=44,uid=0
where the video group has ID 44 inside the container, and all files have root (ID 0) as owner (in ls -lR /dev/).

EDIT: A network printer is also much easier (and can unplug/hot-plug) much easier than a USB printer. Unfortunately, I have no experience and no example for a USB printer.
 
Last edited:
Given that I intend to add 2 USB drives, and that the printer drivers are questionable, I've made the call to drop LXC for the samba server and replace it with an Ubuntu workstation VM.
It works, it's easy, I'm being pragmatic, and it's far from a bad outcome.
I do also sit uneasy with loading CUPS and printer drivers onto the host, it seems counter intuiative to a virtualisation system.

EDIT : also a Jellyfin server doesnt play well with LXC either, i have to pass the video card through. Clearly there is a time and place for a full VM.

Next step, LXC mail server :)

Thanks for the help people!
 
Last edited:

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!