USB GDI Drucker via Passthrough in LXC Container verbinden (CUPS)

H-BLOGX

Member
Feb 14, 2020
81
2
13
55
Germany - Göppingen
www.hasenmueller.de
Hallo, ich melde mich heute nach langer Zeit wieder und habe festgestellt, das ich das Problem früher hier schon mal beschrieben habe

https://forum.proxmox.com/threads/usb-drucker-an-lxc-container-durchreichen.73780/#post-331273

Meine damalige Lösung war, das ich den Drucker an den USB Port meiner QNAP NAS gehängt habe und darüber gedruckt habe.

Auf Grund von einem Umzug und Systemumstellungen fällt jetzt die NAS Lösung flach.

Ziel soll und muss sein, das der GDI Drucker Samsung ML-2010R am USB Port des Proxmox 7.1 Host hängt.
Auf diesem läuft ein Ubuntu 20.04.3 Server als LXC Container (ich möchte keine VM, wegen Performance!) auf welchem ich CUPS installiert habe.

lsusb ergibt

Bash:
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 04e8:326c Samsung Electronics Co., Ltd ML-2010P Mono Laser Printer
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 04f2:b2f4 Chicony Electronics Co., Ltd HP Webcam-50
Bus 001 Device 002: ID 1058:10b8 Western Digital Technologies, Inc. Elements Portable (WDBU6Y, WDBUZG)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 04b3:301b IBM Corp. SK-8815 Keyboard
Bus 003 Device 002: ID 04b3:301a IBM Corp. 2-port low-power hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Mit dem Befehl

udevadm info --query=all --attribute-walk --name=/dev/usb/lp0

habe ich unter anderem folgende Werte ermittelt

Bash:
looking at parent device '/devices/pci0000:00/0000:00:16.0/usb4/4-1':
    KERNELS=="4-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="00"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="16"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0100"
    ATTRS{bmAttributes}=="c0"
    ATTRS{busnum}=="4"
    ATTRS{configuration}==""
    ATTRS{devnum}=="2"
    ATTRS{devpath}=="1"
    [B]ATTRS{idProduct}=="326c"[/B]
    [B]ATTRS{idVendor}=="04e8"[/B]
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Samsung"
    ATTRS{maxchild}=="0"
    ATTRS{power/active_duration}=="301828"
    ATTRS{power/async}=="enabled"
    ATTRS{power/autosuspend}=="2"
    ATTRS{power/autosuspend_delay_ms}=="2000"
    ATTRS{power/connected_duration}=="301828"
    ATTRS{power/control}=="on"
    ATTRS{power/level}=="on"
    ATTRS{power/persist}=="1"
    ATTRS{power/runtime_active_kids}=="0"
    ATTRS{power/runtime_active_time}=="301461"
    ATTRS{power/runtime_enabled}=="forbidden"
    ATTRS{power/runtime_status}=="active"
    ATTRS{power/runtime_suspended_time}=="0"
    ATTRS{power/runtime_usage}=="1"
    ATTRS{product}=="Samsung ML-2010"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{rx_lanes}=="1"
    ATTRS{serial}=="4421BKDPC10415L."
    ATTRS{speed}=="12"
    ATTRS{tx_lanes}=="1"
    ATTRS{urbnum}=="11"
    ATTRS{version}==" 1.10"

Im Verzeichnis /etc/udev/rules.d/ auf dem Host habe ich die Datei 999-usb-drucker.rules erstellt.
Frage: braucht die besondere Berechtigungen?

Bash:
root@proxmox:/etc/udev/rules.d# ll
total 12K
drwxr-xr-x 2 root root 4.0K Dec 29 22:10 .
drwxr-xr-x 4 root root 4.0K Dec  6 13:10 ..
lrwxrwxrwx 1 root root    9 Dec 29 09:34 60-bridge-network-interface.rules -> /dev/null
-rw-r--r-- 1 root root  237 Dec 29 22:10 999-usb-drucker.rules

Der Inhalt ist:

Bash:
# Regel für Samsung USB Drucker, damit die Zuordnung immer die gleiche ist
KERNELS=="4-1", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idProduct}=="326c", ATTRS{idVendor}=="04e8", ATTRS{serial}=="4421BKDPC10415L.", SYMLINK+="usbdrucker"

Meine LXC Config Datei sieht so aus:

Bash:
#Das ist der Printserver als Container. Er soll auf die USB Schnittstelle des Proxmox Host zugreifen um den Laserdrucker Samsung ML-2010R f%C3%BCr Win>
arch: amd64
cores: 1
features: nesting=1
hostname: print
memory: 512
net0: name=eth0,bridge=vmbr0,firewall=1,gw=192.168.192.1,hwaddr=D6:BB:9D:EB:2E:89,ip=192.168.192.202/24,ip6=dhcp,type=veth
onboot: 1
ostype: ubuntu
rootfs: local-lvm:vm-100-disk-0,size=20G
swap: 0
unprivileged: 1
lxc.cgroup.devices.allow: c 189:385 rwm
lxc.mount.entry: /dev/usbdrucker /dev/usbdrucker none bind,optional,create=file

Im Anschluss habe ich den Proxmox einmal neu gestartet.

Auf dem LXC läuft bereits CUPS.

Bei der Eingabe von

lpinfo -v

bekomme ich nur als Ausgabe

Bash:
file cups-brf:/
network beh
network ipp
direct hp
network ipps
network socket
network lpd
network http
network https
direct hpfax

Sprich, der USB Drucker wird aktuell nicht durchgereicht.

Ich habe den Proxmox heute ganz neu installiert.

Kernelversion Linux 5.13.19-2-pve #1 SMP PVE 5.13.19-4 (Mon, 29 Nov 2021 12:10:09 +0100)
PVE-Manager-Version pve-manager/7.1-8/5b267f33

Bin jetzt mit meinem Latein etwas am Ende und bitte um Hilfe.

Gruß H-BLOGX
 

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!