Making cups work

Hi,

I use nixos 20.09. For some reason cups service was crashing after first attempt to connect to /localhost:631

$ journalctl -xe

output read that:

....
gruod. 30 12:29:19 nixos cupsd[18657]: No valid Listen or Port lines were found in the configuration file.
....
The unit cups.service has successfully entered the 'dead' state.
gruod. 30 12:29:19 nixos systemd[1]: cups.service: Start request repeated too quickly.
gruod. 30 12:29:19 nixos systemd[1]: cups.service: Failed with result 'start-limit-hit'.
....

File cupsd.conf in /etc/cups/ was empty. I did not want to edit it so I tried to disable/enable printing service in configuration.nix, disable/enable firewall and ssl hoping that nixos will do the job, but it didn’t. It was quite strange because /etc/cups/ directory was deleted every time after rebuilding configuration with printing services disabled. I even temporarily switched from KDE to i3wm but it didn’t help neither. Finaly I added these lines

# Only listen for connections from the local machine.
Listen localhost:631
Listen /var/run/cups/cups.sock

… to cupsd.conf and cups started to work. It seems that cupsd.conf was not reset correctly after rebuild of nixos. Maybe state of the previous build was affecting new build but in that case the purity of build was compromised. Could someone check out the content of cupsd.conf in the fresh nixos instalation and post it here?

1 Like

you can try doing a

sudo nixos-rebuild build-vm

which will build a complete virtual machine using your current configuraiton.nix

Can you share your configuration.nix. I usually just do services.printing.enable = true and it takes care of everything. It might be easier to help you debug if we can see you config.

1 Like

Here is a link to my configuration.nix

I have just realized that there is no way to declare version of Nixos (or a “channel”) in configuration.nix

build-vm looks like a nice feature. I walked through to a login screen but could not login. Can I login into vm without hashtaged passwords or setting mutableUsers = false ?

sorry for the delay…

try this, check the solution from this post, adding this you should be able to login and test stuff, useful not only for testing this, but also any changes you do to your machine, and what to see if they work, or how they look.