chuckcharlie / cups-avahi-airprint

Docker image for CUPS intended as an AirPrint relay
GNU General Public License v3.0
118 stars 66 forks source link

USB printer not detected (Brother HL-L2300D) #27

Closed zacs closed 6 months ago

zacs commented 6 months ago

I have a vanilla Ubuntu 22 server with Docker on it, and am using this image to try and connect my printer. CUPS works fine (admin interface, etc) and I'm using pretty much exactly the docker-compose.yaml from this repo. However, CUPS doesn't detect my Brother HL-L2300D printer. The USB device is available within the container, but no dice.

image

Inside the container:

/ # lsusb
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 002: ID 04f9:0061

On the host:

$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 04f9:0061 Brother Industries, Ltd HL-L2300D series
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

When I try to run lpinfo I am denied:

$ docker exec -it cups sh
/ # lpinfo -v
lpinfo: Forbidden

I also installed the brlaser package on the host machine in hopes that that would solve things, but got no dice. Any ideas or info on how I can enable logging to see what's happening? I'm new to CUPS so it's possible I'm missing something very basic when trying to add the printer.

chuckcharlie commented 6 months ago

Interesting. I haven't messed with USB much. That forbidden error is likely caused by the wheel group missing in the config. Can you try running this command in the container, then restart and test?

sed -i '/^SystemGroup/ s/$/ wheel/' /etc/cups/cups-files.conf
zacs commented 6 months ago

Ah that command worked great to get lpinfo working, thanks!

Is there any way to enable debug logging just so I can putz around and try to troubleshoot the USB printer? I assumed that your inclusion brlaser in the Dockerfile apk installs it would just work but can try to troubleshoot.

zacs commented 6 months ago

Ah, answering my own question, but putting here for posterity. Even though the docker-compose.yml has privileged: true, you have to also explicitly add the device as well. So adding:

devices:
  - '/dev/usb/lp0:/dev/usb/lp0'

to the compose file got me going. Appreciate the fast reply!

chuckcharlie commented 6 months ago

Awesome. That was going to be my next suggestion. Enjoy!