Unable to talk to CUPS #3

Closed
opened 2026-08-27 12:02:55 +03:00 by shimitar · 12 comments

So, here it goes my compose file:

services:
  webprint:
    image: forged.hel.alfredolin.eu/webprint:latest
    ports:
      - "3311:3001"
    environment:
      - PORT=3001
      - JWT_SECRET=whatever
      - PRINTER_NAME=Casa
      - ADMIN_USER=admin
      - ADMIN_PASS=admin
      - DEBUG_ERRORS=true
      - GIN_MODE=test
    volumes:
      - ./db:/data
      - ./tmp-printing:/tmp/printing-app
      - /run/cups:/run/cups
    restart: unless-stopped
#    depends_on:
#      - cups
    networks:
      - webprint-net

networks:
  webprint-net:
    dns_enabled: true

i am using rootless podman and i have "cups" running on the server machine (the /run/cups...) with one printer configured and working (and shared via network as well).

Inside webprint, i see no printer and cups sync is successfull, but no printer.

So, here it goes my compose file: ``` services: webprint: image: forged.hel.alfredolin.eu/webprint:latest ports: - "3311:3001" environment: - PORT=3001 - JWT_SECRET=whatever - PRINTER_NAME=Casa - ADMIN_USER=admin - ADMIN_PASS=admin - DEBUG_ERRORS=true - GIN_MODE=test volumes: - ./db:/data - ./tmp-printing:/tmp/printing-app - /run/cups:/run/cups restart: unless-stopped # depends_on: # - cups networks: - webprint-net networks: webprint-net: dns_enabled: true ``` i am using rootless podman and i have "cups" running on the server machine (the /run/cups...) with one printer configured and working (and shared via network as well). Inside webprint, i see no printer and cups sync is successfull, but no printer.
Owner

This should be a common use case. I'll look into that. Glad you haven't given up yet.

This should be a common use case. I'll look into that. Glad you haven't given up yet.
Owner

I can not replicate that one :/
I tried with os installed cups, UID/GID 1000 (not cups, which would be lp or root respectively with uid 7 or 0), binding the volumes as you did and it discovers the printers fine. Btw for me cups.sock has read/write permissions for all users: 666.

I can not replicate that one :/ I tried with os installed cups, UID/GID 1000 (not cups, which would be lp or root respectively with uid 7 or 0), binding the volumes as you did and it discovers the printers fine. Btw for me cups.sock has read/write permissions for all users: 666.
Author

how do i see or enable more logging?

how do i see or enable more logging?
Owner

I will have to code them. In the mean time can you check what permissions are set for /run/cups/cups.sock? I'm not sure how to handle this.

I will have to code them. In the mean time can you check what permissions are set for /run/cups/cups.sock? I'm not sure how to handle this.
Owner

Actually, I could somewhat reproduce. If the /run/cups/cups.sock has permissions srw-rw---- and is owned e.g. root:lp or lp:root and your docker's uid/gid is not 0 or 7 (root or lp), it's not gonna work.
So either add read/write permissions to others sudo chmod 666 /run/cups/cups.sock or run your container as lp if you want to avoid root (assuming lp is uid or gid owner, which could also be set).
Currently the writing is only used for setting the printer location and it's still buggy so actually read-only permission would be sufficient.

I did not find how to change the owners/permissions from the cups config yet. If someone knows, I'm all ears.

Actually, I could somewhat reproduce. If the /run/cups/cups.sock has permissions srw-rw---- and is owned e.g. root:lp or lp:root and your docker's uid/gid is not 0 or 7 (root or lp), it's not gonna work. So either add read/write permissions to others `sudo chmod 666 /run/cups/cups.sock` or run your container as lp if you want to avoid root (assuming lp is uid or gid owner, which could also be set). Currently the writing is only used for setting the printer location and it's still buggy so actually read-only permission would be sufficient. I did not find how to change the owners/permissions from the cups config yet. If someone knows, I'm all ears.
Owner

I think I found a solution. We will add a variable with the group id of lp (cups user) and add it to the container's GID. This change should not need a rebuild, it will flow in the next release. I will also add more logs in case of errors, which are currently (v1.0.2) silenced.

I think I found a solution. We will add a variable with the group id of `lp` (cups user) and add it to the container's GID. This change should not need a rebuild, it will flow in the next release. I will also add more logs in case of errors, which are currently (v1.0.2) silenced.
Owner

Ok, we should now be able to read the socket by adding the right LP_GID in the .env! Can you pull latest (v1.0.3) and retest?

Ok, we should now be able to read the socket by adding the right LP_GID in the .env! Can you pull latest (v1.0.3) and retest?
Author

Ok, i had my cups misconfigured. The local unix socket was disabled. After enabling it i can see the printer in WebPrint! Huge step forward!

(i added my "webprint" user to lp group and checked that it could print first, then LP_GID=7 in docker-compose, and bang, it see the printer in the web gui!)

but i doesnt print anything. In the logs i only see:

[webprint] | 2026/08/29 16:54:19 [Auth] Cookie err: <nil>, token length: 153
[webprint] | 2026/08/29 16:54:19 [Auth] Valid token for user: admin
[webprint] | [GIN] 2026/08/29 - 16:54:19 | 403 |     7.31524ms |       10.89.0.2 | POST     "/print"

but that's the same for almost all requests. It seems that CUPS does not receive the job at all, nothing in the logs

Ok, i had my cups misconfigured. The local unix socket was disabled. After enabling it i can see the printer in WebPrint! Huge step forward! (i added my "webprint" user to lp group and checked that it could print first, then LP_GID=7 in docker-compose, and bang, it see the printer in the web gui!) but i doesnt print anything. In the logs i only see: ``` [webprint] | 2026/08/29 16:54:19 [Auth] Cookie err: <nil>, token length: 153 [webprint] | 2026/08/29 16:54:19 [Auth] Valid token for user: admin [webprint] | [GIN] 2026/08/29 - 16:54:19 | 403 | 7.31524ms | 10.89.0.2 | POST "/print" ``` but that's the same for almost all requests. It seems that CUPS does not receive the job at all, nothing in the logs
Owner

Sorry to ask, but are you sure that you pulled the image from latest? There should be more going on in the logs during the printing job.

I could reproduce! Working on it.

~~Sorry to ask, but are you sure that you pulled the image from latest? There should be more going on in the logs during the printing job.~~ I could reproduce! Working on it.
Owner

One question to confirm I am on the right track, what filetype were you trying to print?

One question to confirm I am on the right track, what filetype were you trying to print?
Owner

Release v1.0.4 (latest) should now solve that. I mean, you will probably get an error because your printer rejects the job, but it won't stay stuck and should give the info in the logs.

Release v1.0.4 (latest) should now solve that. I mean, you will probably get an error because your printer rejects the job, but it won't stay stuck and should give the info in the logs.
Author

pulled latest image... Now it prints! Great work!

pulled latest image... Now it prints! Great work!
Alfredolin added reference refs/tags/v1.0.4 2026-08-31 17:10:21 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Alfredolin/WebPrint#3
No description provided.