Getting CUPS to work on TrueNAS Scale?

Hi guys,

So I am trying to set up CUPS on my server and I have done so successfully. I can print to it and everything is fine except for 2 things:

  1. My config doesn’t seem to save every time I restart CUPS and I’m not sure how /where to mount the config file?

  2. If I turn off the printer whilst cups is running and then back on again, it won’t reconnect to the printer. Cups has to be restarted.

Let me know if you have any ideas on how to solve these issues? Ideally, I can just have cups running in the background and then turn on the printer when I need to, print to it and then turn it off etc.

Thanks
-James :slight_smile:

Ho exactly did you set up CUPS?

I added the image repository as a custom app

https://hub.docker.com/r/olbat/cupsd

This is the one i used

So you used the apps subsystem - good. Now you need to find out how to change that custom app to use persistent storage for its configuration.

The trick probably is in the second command line on that page you linked:

docker run -d -p 631:631 -v /var/run/dbus:/var/run/dbus -v $PWD/cupsd.conf:/etc/cups/cupsd.conf --name cupsd olbat/cupsd

So create e.g. <mypool>/data/cups and change that part of the command to: -v /mnt/<mypool>/data/cups//cupsd.conf:/etc/cups/cupsd.conf

HTH,
Patrick

I shall give it a go. Thanks!

And in terms of mounting the storage within the app setup, is there anything specific I need to do there?

Hey James,

I’ve had similar issues with CUPS on my server. For the config not saving, try editing the config file directly in /etc/cups/cupsd.conf as root. That’s what worked for me.

As for the printer reconnecting, it’s a bit of a pain, right? I found that setting up a small script to restart CUPS whenever the printer is turned on worked for me. It’s not the most elegant solution, but it gets the job done. If you’re comfortable with that, give it a try.

The -v … is the specific parameter for mounting. Not tested but should work.

Thats for that, very insightful.

Could you tell me exactly what I should be editing? Currently, every time I restart CUPS, it is like a fresh install. No data at all has saved so i have to re-add the printer

That script sounds interesting. What about when you turn the printer off?

okay thanks ill give it a go and report back

Maybe a noob question here but im not over familiar with running lunix commands.

But where do I run that command? I tried running it in the shell of the app and then of the server and both didn’t work and said “zsh: command not found: -v”

The command I’m running:
-v /mnt/mainpool/cups//cupsd.conf:/etc/cups/cupsd.conf

Let me know, thanks again

You somehow created a custom app from the command line on top of that article, didn’t you? I never used custom apps, so that’s why I said you need to find out.

The idea is to tell your custom app instead of

docker run -d -p 631:631 -v /var/run/dbus:/var/run/dbus --name cupsd olbat/cupsd

to use

docker run -d -p 631:631 -v /var/run/dbus:/var/run/dbus -v /mnt/mainpool/cups//cupsd.conf:/etc/cups/cupsd.conf --name cupsd olbat/cupsd

You need to recreate your app and add that parameter - somehow. Just like you did the first time, but with that extra thing added? I guess?

No I didnt create anything from the command line. I’m not that good haha.

I just added a custom app through Discover apps > Custom app and then added the image repository there.

So how would I add these variables? or specifically under which section?

Edit the custom app, where is says storage, hostpaths in the UI, add them. I am not sure, but don’t think it will let you add /var/run/dbus.

Thanks for your input, I appreciate it.

Like this? I’m a little out of my depth for custom apps and running variables

No, the docker command line says:

-v /var/run/dbus:/var/run/dbus

This means mount path /var/run/dbus which you have, and, host path also /var/run/dbus, which you cannot select, I don’t think it’s allowed.

That being said, I think for some path not normally allowed, I did a ln -s on it to make a symbolic link so that the symbolic link was within /mnt somewhere and I believe it worked

So you’re saying something like this may work?

No, there is no - anything. In the hostpath box is simply /var/run/dbus, but I don’t think it will save,. Try it. The ln command is a shell command.

Yeah, it failed

Hello,

I am new in TrueNAS Scale but I successfully installed it on my old PC and now I have a briliant storage server with Nextcloud, qBittorrent, Portainer and so on.
Also I want to transform my old Laser Jet 1018 USB printer into a network one. For this particular reason, I want to install CUPS but I have exactly the same issue as the author of this topic.
Can someone share his experience if already run this custom app or try to help me with some advices.
Thanks in advance and good day to all of you.