home | codereading | contact | github | math | misc | notes | patches | tech | README

CUPS notes

This document shows how to install and configure CUPS under NetBSD. It installs cups from pkgsrc.


If you are looking about how to print to a Windows Print Server, please, see the SMB on Unix page.

lp* CLI utilities basics

To discover all available printers, installed by CUPS, type:

$ lpstat -a

To see all available options of a printer, type:

$ lpoptions -p printer_name -l

To print a file, type:

$ lpr -P printer_name file

To configure the default printer, just do (reference here):

$ loptions -d printer_name

The lpoptions command can also be used to set default behaviour of the printer. The following command makes the documents always be printed in both sides of the sheet:

$ lpoptions -o sides=two-sided-long-edge

Cups in NetBSD

  1. Install pkgsrc/print/cups

  2. Install pkgsrc/print/ghostscript package. Be sure that you enable the cups option when compiling:

    make PKG_OPTIONS.ghostscript=cups
  3. Now cd /usr/bin and rename all lp* by lp*_ This will prevent the system for using standard lp*. Notice that /usr/pkg/bin needs to be in your ${PATH} (CUPS's lp* are there). Another solution is to take off execution permission from them.

  4. su and cp /usr/pkg/share/examples/rc.d/cupsd /etc/rc.d

  5. su and cat cupsd=YES >> /etc/rc.conf

  6. su and /etc/rc.d/cupsd start

  7. Open the browser and type at the address bar: localhost:631

CUPS troubleshooting

"Error - no default destination available"

Whenever the following error from lp* executables appear:

"Error - no default destination available."

Set a default printer in CUPS. You can set a default printer using the lpoptions command line program, too.

Printing in both sides of the sheet

If the printer supports printing in both sides of the sheet, just pass the -o sides=two-sided-long-edge option two lpr:

$ lpr -P printer_name -o sides=two-sided-long-edge file

The two-sided-short-edge is recommended for landscape pages.

References: conectiva.com.br

Error "pending since ..."

Your CUPS stopped to print and job status tell you obscure stuff like "pending since ..."?

I just changed the driver (choose a generic one) and it works now.

Later, I discovered that the printer can be "Paused" (with no reason!). Open CUPS administration tool in your web browser with http://localhost:631/ and go to the "Printers" tab. Select your printer. In the "Maintenance" combo box, see if there is a "Resume printer" option. Click it.

Unsupported format 'application/vnd.cups-banner'! when printing test page

If you just added a new printer and got this error when trying to print a test page, it is probably more complex than it seems. In my case, pstoraster program, that is usually installed with ghostscript, was lacking in my system.

It was not obvious, but Michael Sweet, on the cups.general forum, kindly helped me to diagnose the problem, in this thread.

What I had to do is to recompile ghostcript from pkgsrc with cups support.