Printing: Difference between revisions
imported>Makefu No edit summary |
imported>StijnDW Add a Troubleshooting section |
||
Line 83: | Line 83: | ||
[[Category:Configuration]][[Category:Hardware]] | [[Category:Configuration]][[Category:Hardware]] | ||
=Troubleshooting= | |||
===Upgrade Required=== | |||
Described in: [https://github.com/NixOS/nixpkgs/issues/23993 Github issue 23993]<br /> | |||
'''Problem'''<br /> | |||
Using the cups web interface, the page tells you "Upgrade Required" and then redirects you to a page that fails to load.<br /> | |||
'''Cause'''<br /> | |||
When you are using http and cups wants authentication it will redirect you to a https version by default.<br /> | |||
In order to use https it needs ssl keys. However it is possible that cups fails to generate these keys, and then the page will fail to load.<br /> | |||
'''Solution'''<br /> | |||
Either we can help cups to get ssl keys, or we can tell it to not use https at all.<br /> | |||
''Generating ssl keys:''<br /> | |||
First make sure the directory /etc/cups/ssl exists:<br /> | |||
<code>sudo mkdir -p /etc/cups/ssl</code><br /> | |||
Try restarting cups and using the web interface again. This might be enough to get it working.<br /> | |||
If this didn't help, then check if cups has generated ssl keys in /etc/cups/ssl<br /> | |||
''Disabling ssl:''<br /> | |||
Edit your <code>/etc/nixos/configuration.nix</code> and add the following lines:<br /> | |||
<code><pre>services.printing.extraConf = '' | |||
DefaultEncryption Never | |||
'';</pre></code> | |||
===Unable to launch Ghostscript: gs: No such file or directory=== | |||
Described in: [https://github.com/NixOS/nixpkgs/issues/20806 Github issue 20806]<br /> | |||
'''Problem'''<br /> | |||
When printing, cups will report an error: Unable to launch Ghostscript: gs: No such file or directory<br /> | |||
'''Cause'''<br /> | |||
Some drivers use the ghostscript binary.<br /> | |||
Cups will look for the binary path in it's config file: cupsd.conf<br /> | |||
This file is normally a link. But it can be overwritten, and consequentially become outdated.<br /> | |||
'''Solution'''<br /> | |||
You could try to manually fix the path variable in /var/lib/cups/cupsd.conf<br /> | |||
Alternatively you could try to delete the file and run <code>sudo nixos-rebuild switch</code> |
Revision as of 20:51, 17 February 2018
Basic configuration
- Add to
/etc/nixos/configuration.nix
:{ ... services.printing.enable = true; services.printing.drivers = [ YOUR_DRIVER ]; ... }
where
YOUR_DRIVER
is the driver package appropriate for your printer. Commonly used driver packages include:- pkgs.gutenprint — Drivers for many different printers from many different vendors.
- pkgs.gutenprintBin — Additional, binary-only drivers for some printers.
- pkgs.hplip — Drivers for HP printers.
- pkgs.samsungUnifiedLinuxDriver — Proprietary Samsung Drivers
- pkgs.splix — Drivers for printers supporting SPL (Samsung Printer Language).
- Some printers might be supported by built-in CUPS drivers.
- Search for other printer drivers in the NixOS package directory.
(Add the driver to
services.printing.drivers
, notenvironment.systemPackages
.) - Rebuild: CUPS will be started automatically.
$ sudo nixos-rebuild switch
Navigate to http://localhost:631/ in a web browser to configure printers. Alternatively, some desktop environments may provide GUI interfaces for adding printers.
You may need to authenticate when you add the printer. Search the web for e.g. “cups add printer” for further information.
Server
- Follow the steps in Basic Configuration, but check “Share This Printer” when adding it to CUPS. If you have already added the printer to CUPS, reconfigure it to make it a shared printer.
- You should probably check that printing works locally at this point.
- Amend /etc/nixos/configuration.nix:
{ ... # Enable automatic discovery of the printer from other Linux systems with avahi running. services.avahi.enable = true; services.avahi.publish.enable = true; services.avahi.publish.userServices = true; services.printing.browsing = true; services.printing.listenAddresses = [ "*:631" ]; # Not 100% sure this is needed and you might want to restrict to the local network services.printing.defaultShared = true; # If you want networking.firewall.allowedUDPPorts = [ 631 ]; networking.firewall.allowedTCPPorts = [ 631 ]; ... }
- Rebuild:
$ sudo nixos-rebuild switch
Note: I think I had to check "Share printers connected to this system" and "Allow printing from the internet" at http://192.168.11.9:631/admin but I'm not sure.
Client (Linux)
If you enabled services.avahi.publish.userServices
in the server configuration, enabling printing and avahi on the client should be sufficient for the printer to be detected:
{
...
services.printing.enable = true;
services.avahi.enable = true;
services.avahi.nssmdns = true;
}
Alternately, the printer can be added to the client's CUPS daemon by navigating to http://localhost:631/ in a web browser and adding the remote printer.
See also
- How to properly setup a shared (home) printer? #13901
- Printer sharing (Arch Linux wiki)
- Little Printing/CUPS Documentation for Configuration as a Print Server #23993
- Old wiki page
Troubleshooting
Upgrade Required
Described in: Github issue 23993
Problem
Using the cups web interface, the page tells you "Upgrade Required" and then redirects you to a page that fails to load.
Cause
When you are using http and cups wants authentication it will redirect you to a https version by default.
In order to use https it needs ssl keys. However it is possible that cups fails to generate these keys, and then the page will fail to load.
Solution
Either we can help cups to get ssl keys, or we can tell it to not use https at all.
Generating ssl keys:
First make sure the directory /etc/cups/ssl exists:
sudo mkdir -p /etc/cups/ssl
Try restarting cups and using the web interface again. This might be enough to get it working.
If this didn't help, then check if cups has generated ssl keys in /etc/cups/ssl
Disabling ssl:
Edit your /etc/nixos/configuration.nix
and add the following lines:
services.printing.extraConf = ''
DefaultEncryption Never
'';
Unable to launch Ghostscript: gs: No such file or directory
Described in: Github issue 20806
Problem
When printing, cups will report an error: Unable to launch Ghostscript: gs: No such file or directory
Cause
Some drivers use the ghostscript binary.
Cups will look for the binary path in it's config file: cupsd.conf
This file is normally a link. But it can be overwritten, and consequentially become outdated.
Solution
You could try to manually fix the path variable in /var/lib/cups/cupsd.conf
Alternatively you could try to delete the file and run sudo nixos-rebuild switch