using CUPS under Solaris 9

Jim Gourlay jim.gourlay at eastdunbarton.gov.uk
Fri Sep 1 07:47:34 PDT 2006


installed cups as recommended by Sun - see below

all went well until I tried command lines (eg. lpinfo & lpadmin) which generated "server-error-operation-not-supported" errors.

cups version is 1.1.20


Sun recommended method of installation
--------------------------------------

Installing CUPS on the Solaris 9 Operating System
Alejandro Piro, January, 2005

The Common UNIX Printing System (CUPS) is an open-source tool that, when installed, causes a box running the Solaris OS to act like a print server, managing all print queues on a network.

CUPS supports several printing protocols, including the Line Printer Daemon (lpd), the Server Message Block (smb), and the AppSocket (Jet Direct).

Printers may be located on the network or connected locally to serial ports, a parallel port, or universal serial bus (USB) ports. You can download and update printers and drivers from a web site. A system administrator creates, manages, and modifies printers and queues using a web-based graphical user interface (GUI). In addition, commands are available to execute in the command-line interface (CLI).



Installing CUPS
You don't need to compile anything because you can access the Solaris package in one of two ways, listed below. (Both methods install the files -- including commands, binaries, logs, and so on -- into subdirectories under /opt/sfw/cups.)

Find it on the Solaris 9 Companion CD. Under the application/networking section, select the two components cups and cupsprint.

Download it from sunfreeware:
ftp://ftp.sunfreeware.com/pub/freeware/companioncd/sparc/9

The file name for cups-x.x.xx-pkg.zip differs depending on the version of the package. Once you have downloaded the file, unzip the file and install the packages using the pkgadd command. An example follows:

# unzip cups-1.1.14-pkg.zip
# pkgadd -d SFWcups

These packages are installed:

system	SFWcprnt 	cupsprint - CUPS Print Suite Cluster
system	SFWcups		cups - Common UNIX Printing System



The Printing System
CUPS is a complete printing system; therefore, make sure that the Solaris printing system and CUPS are not running at the same time.

Stop the lpd service and rename the file in rc2.d:

# /etc/init.d/lp.stop
# mv /etc/rc2.d/S801p /etc/rc2.d/s801p



Printing Commands
Before you configure the software, make a backup of the Solaris printing commands and link to the CUPS commands, as shown here. The first column includes the Solaris commands, and the second column shows what those commands link to:

/usr/bin/lp 		/opt/sfw/cups/bin/lp
/usr/bin/lpstat 	/opt/sfw/cups/bin/lpstat
/usr/bin/cancel 	/opt/sfw/cups/bin/cancel
/usr/bin/enable 	/opt/sfw/cups/bin/enable
/usr/sbin/lpadmin 	/opt/sfw/cups/sbin/lpadmin
/usr/sbin/lpmove 	/opt/sfw/cups/sbin/lpmove
/usr/sbin/accept 	/opt/sfw/cups/sbin/accept

For example, you might do something like the following to replace the lp command:

# mv /usr/bin/lp /usr/bin/lp.solaris
# ln -s /opt/sfw/cups/bin/lp /usr/bin/lp

Repeat the replacement commands for each command listed above.

To use the CUPS printer admin commands, include the following subdirectories in your path:

/opt/sfw/cups/bin:/opt/sfw/cups/sbin



Configuring CUPS
The main configuration file for CUPS is: /opt/sfw/cups/etc/cups/cupsd.conf. This file has the same format as many other configuration files, such as those used by the Apache Web server. For CUPS, modify the option relative to the format of the printcap file as follows:

# PrintcapFormat: the format of the printcap file, currently either
# BSD or Solaris. The default is "BSD".
#
# PrintcapFormat BSD
PrintcapFormat Solaris



Starting CUPS
Copy the start/stop script and make links to run levels 2 and 1, ensuring that CUPS starts on the next reboot:

# cp /opt/sfw/cups/etc/init.d/cups /etc/init.d
# ln -s /etc/init.d/cups /etc/rc2.d/S99cups
# ln -s /etc/init.d/cups /etc/rc1.d/K99cups


To start the CUPS scheduler, type:

# etc/init.d/cups start



Creating New Printers
Now that CUPS is running, you are able to configure, add, or modify printers using two methods: command line and web interface. Each print queue has a name and a device associated with it. The devices use the Uniform Resources Identifiers (URI) form. For example, the serial port "a" uses a device URI of serial:/dev/cua/a?baud=115200.

To see a list of supported devices, you can run the following command:

# lpinfo -v

The first word in each line is the type of device (direct, file, network, serial), followed by the device URI.

Finally, printer queues usually have an associated PostScript Printer Description (PPD) file. These files are used for PostScript and non-PostScript printers. CUPS includes PPD files for HP LaserJet, HP DeskJet, Epson, and so on.

To add a printer from the command line, you can use the lpadmin command.

lpadmin -p printer -E -v device -m ppd

Here printer is the name of the printer, device is the path to reach the printer, and ppd is the name of the PostScript Printer Description file.

For example, you would use this for a networked HP LaserJet printer using a JetDirect network interface at IP address 11.22.33.44:

# lpadmin -p Laserjet -E -v socket://11.22.33.44 -m laserjet.ppd

To check, use the lpstat command:

# lpstat -v

To configure, add, or modify printers via the GUI, use a web browser and open the URL:

<http://localhost:631> or <http://127.0.0.1:631>

Select the Do Administration Tasks option.


In the web interface, CUPS provides a user-friendly "wizard" to add a printer. Follow the steps after you click on the Add Printer button.

To test the printer, use the -d option with the lp command to print to a specific printer:

# lp -d printer filename

Or you can select Manage Printers, Print Test Page from the web interface.



Troubleshooting
To find out what's going wrong, first you should increase the log level. To increase the log level, edit the configuration file /opt/sfw/cups/etc/cups/cupsd.conf and set the LogLevel variable to debug instead of info:


#
# LogLevel: controls the number of messages logged to the ErrorLog
# file and can be one of the following:
#
# debug2  	Log everything.
# debug  	Log almost everything.
# info  	Log all requests and state changes.
# warn  	Log errors and warnings.
# error  	Log only errors.
# none  	Log nothing.
#

LogLevel debug

Then restart the scheduler and look at the files access_log and error_log in the /opt/sfw/cups/var/log/cups directory.








More information about the cups-devel mailing list