CUPS doesn't start, then requires login for admin task from browser

Initial access from browser fails with “cannot connect.” systemctl status cups shows not running due to no “cups” in /var/run/qubes-services. Do a sudo touch /var/run/qubes-services/cups and then systemctl restart cups. Can now access/connect but admin tab asks for login. “user” and my password do not work, “user” and no password doesn’t work. I can do these tasks outside the browser with “Print Settings.” Furthermore, the cups file disappears on reboot, both in template and qube. Have tried to add a group cups-admins and added “user” and edited cups configuration. When I do “whoami” in either template or qube I get “user” so that would seem to not be the problem. So two questions:

  1. How to start CUPS when the qube starts
  2. How to log in via browser for admin tasks
    Any suggestions appreciated!
1 Like

You are probably using Fedora because you are prompted to log in.
The configuration is set up to ask for a login and uses policy to restrict admin access to basic users.
The configuration is more “free” on Debian, if you want to try it out.
If you want to continue using Fedora, you will need to tweak the configuration a bit.

You can add the following to /rw/config/rc.local

sed -i 's/Require user @SYSTEM/Allow user/g' /etc/cups/cupsd.conf
sed -i 's/DefaultAuthType Basic/DefaultAuthType None/g' /etc/cups/cupsd.conf
systemctl start cups

Also, add the “cups” service in the qube settings service tab via the drop down menu.

3 Likes

That worked! Thank you. I am indeed on Fedora. Strange thing is it used to work in the past (could type anything for un/pw).
Logical next question: Does the system ‘rewrite’ the cupsd.conf file on every start so that it has to be ‘edited’ each time? If so why?
Thanks for solving, learning more every day :slight_smile:

1 Like

If you are using a qube (AppVM), the changes will be lost on each reboot because only a few paths are kept inside the private volume. That’s why /rw/config/rc.local comes in handy, because it persists and can run the commands on qube startup. There is also bind-dirs if you want to make some other directory/file persistent.

For more information about persistence:

1 Like

You can enable cups in the “services” tab of qube settings. If “cups” is not included in the drop down at the top, select custom and add “cups” manually.

2 Likes

Thanks for the feedback. Creating the empty cups file works, but it disappears on reboot (even from the template). The action of adding the service via cube’s services setting works.

1 Like

Hope not to be a bother, but I set up the printers in the template for all cubes (based on that template) to have access. I am under the impression that per your instructions the config is edited on each start, which for the template wouldn’t be necessary? It shouldn’t hurt though because if the change is permanent then subsequent edits will simply fail and leave the file in the desired state… Also, do we need the systemctl start cups if cups is added as a service via template/cube settings? As I said, it works so it is not important, just curious.

Cheers,
Art

1 Like

I always try to leave templates unchanged on my setup, I just install packages on them and leave the configuration change per qube. That’s why I gave those instructions, but you’re right that you can edit it in the template and remove the sed commands.

It seems to be necessary, at least on Fedora. Adding the service starts it correctly on Debian, but for some reason it doesn’t seem to do anything on Fedora.

1 Like

@ans1 maybe this also helps (based on Debian minimal)

1 Like

Thanks. Configuration by qube does indeed make sense. I think I’ll start doing that.
Cheers,
Art

2 Likes

Thanks for the feedback. I definitely will have a look, as I run both Fedora and Debian qubes (it’s more fun to confuse myself :slight_smile: )
Cheers,
Art

1 Like