linuxserver / docker-baseimage-kasmvnc

Base Images for remote web based Linux desktops using KasmVNC for many popular distros.
GNU General Public License v3.0
282 stars 48 forks source link

[BUG] kasm_printer_service not working? #43

Closed hgw77 closed 6 months ago

hgw77 commented 6 months ago

Is there an existing issue for this?

Current Behavior

I have no idea how it should looks like because I was never able to print from the webtop desktop

Expected Behavior

I do not have an idea how it looks like because it never worked ;-) but I guess it opens a print dialog in the browser to print the document from the webtop with the installed printer on the client?

Steps To Reproduce

I was checking the repo and found that the kasm_printer_service is startet with kasminit here So I tried to reproduce it by running the command in the container terminal.

  1. When I try to start that script inside the webtop container I get
/kasmbins/kasm_printer_service --directory $HOME/PDF --relay /tmp/printer
kasm_printer_service: Failed to open /proc/self/exe: Permission denied
  1. retry with sudo

    sudo /kasmbins/kasm_printer_service --directory $HOME/PDF --relay /tmp/printer
    INFO:KasmPrintingService:Watching for PDF documents at /config/PDF

    but the permission to /config/PDF/ is root so I changed it with chown abc.users /config/PDF/

  2. next try to save a pdf inside /config/PDF/ and I can see the log message INFO:KasmPrintingService:Sending "/config/PDF/Untitled 1.pdf" for printing (6857B) but nothing more happens....

I guess the command in kasminit here is not working because of permission problems? I never saw the PDF/ directory in my home dir before.

Environment

- OS: webtop ubuntu-kde
- How docker service was installed: `apt get install docker.io` debian-12

Docker creation

docker run -d \
  --name=webtop \
  -e PUID=1026 \
  -e PGID=100 \
  -e TZ=Etc/UTC \
  -e TITLE=Webtop \
  -p 3000:3000 \
  -p 3001:3001 \
  -v /home/hgw/webtop/:/config \
  --device /dev/dri:/dev/dri \
  --restart unless-stopped \
  lscr.io/linuxserver/webtop:ubuntu-kde

Container logs

[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1026
User GID:    100
───────────────────────────────────────

**** adding /dev/dri/card0 to video group video with id 44 ****
**** adding /dev/dri/renderD128 to video group messagebus with id 105 ****
[custom-init] No custom files found, skipping...
_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

Xvnc KasmVNC 1.2.0 - built Jan 27 2024 18:54:25
Copyright (C) 1999-2018 KasmVNC Team and many others (see README.me)
See http://kasmweb.com for information on KasmVNC.
Underlying X server release 12014000, The X.Org Foundation

[ls.io-init] done.
github-actions[bot] commented 6 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

thelamer commented 6 months ago

The kasminit and everything in /kasmbins is for using the images with Kasm workspaces. It requires their frontend and accompanying backend as kclient has no logic for their micro services.

hgw77 commented 6 months ago

ah thanks for the explanation, now I remember that some features are only available in Kasm workspaces.

I have now helped myself with the printer setup in a different way by adapting the start script for cups that I found under /etc/cups/start_cups.sh So my printers, that I have setuped before and stored as ppd-files, are created when I start cups with that script.

But I just can't find a way to run this script when the container starts. In root there is /defaults/autostart I added the command /etc/cups/start_cups.sh there (I adapt this in my own Dockerfile) but somehow it doesn't work when the container is started. Any idea how I can run the cups script at container start?

thelamer commented 6 months ago

You should look at the startwm.sh script, auto start is an easy to use plop an executable name in there for running a single app on top of openbox. Can be overridden with /defaults/startwm.sh in the container.

Webtop example: https://github.com/linuxserver/docker-webtop/blob/master/root/defaults/startwm.sh

Core logic to run openbox: https://github.com/linuxserver/docker-baseimage-kasmvnc/blob/master/root/defaults/startwm.sh

Keep in mind at this run level you are the user not root in both the case of startwm and autostart. If you need root perms you need to learn s6 init v3 or just use sudo in these userspace scripts. Look over the code in root/etc in this repo for how that init works.

hgw77 commented 6 months ago

thank you with that hint I injected my line of code into the startwm.sh script and now cups is running and I can print from my desktop-container 👍