CUPS in the School of Computer Science

We describe the work being done to setup a CUPS server along with a Print Accounting system for the School of Computer Science. Ultimately this system will replace the lpr and lpquota systems.

See PrintingProblems for a discussion of problems with the xhier lpr system and how cups may be a solution to these problems.

Cups Server which uses Pykota/PostgreSql print quota system

See CupsCsServer.

Managing Users and Printers on the CUPS server cups.cs

See ManageUsersPrintersOnPykota

See CreateCupsPrinterStepByStep

Creation of Xhier CUPS packages

Three CUPS related xhier packages have been created, namely, cups-1.2.X_dev, consisting of static libraries and header files; cups-1.2.X_runtime, consisting of dynamic libraries; and cups-1.2.X, the main CUPS package containing the daemon cupsd along with the various administrative and client oriented commands. A wrapper script for CUPS lpr command has been created that emulates some of the -Z options that the old Xhier lpr package uses albeit not all options are supported. The man page for lpr has also been suitably edited to reflect the aforementioned emulation of the -Z options. The documentation as described in the man pages is a little sparse, in particular, the full command line options of the lpr command is not present in the man page of lpr. Look at http://print.cs:631/help/options.html for a much more complete summary. In particular, CUPS, can print a lot of different file types including PDF, JPEG, ASCII text, etc.

Unfortunately the CUPS developars are taking too much advantage that CUPS is based on the HTTP 1.1 protocol in that they like to create webpages and not offer a corresponding man page. I have created a cups-lpr-cover-1 package on xhier to amend this deficiency. It uses xh-ln to substitutes it's own lpr man page when installed on a machine with the cups-1.2.X xhier package. It can be installed on Linux hosts to replace the vendor's man pages if so desired.

Cups on print.cs (services102.cs)

As the cupsd daemon listens to port 631 by default it does not conflict with the xhier lpd daemon which listens to port 515. The CUPS package is not installed in the default path.

The server on print.cs forwards jobs to our lpd running on print.cs. To configure the cups server go to http://print.cs:631. There is a possibility that firefox hangs when adding PPD file for a new printer unless you run firefox directly on the print server. If you find this is the case, use mozilla. People who are in the Unix group www_cscf (as defined by /etc/group and managed by accounts-master database on cscf.cs) can configure printers, that is, if CUPS asks for password authentication, type in your username and passwd as defined in the core.cs region.

Until an alternate way of accounting for print jobs on the cups side can be installed, you should always choose choose lpd for the CUPS backend and send the jobs to print.cs so that the lpquota system will come into play. In other words, do not send jobs directly to the printers albeit for printers where accounting is not an issue it may be permissible to do so but keep in mind this implies the printers will be accessible to anyone who is running a CUPS server on the subnet (see below for some host which have this behaviour).

Restarting the CUPS server

  • /software/cups/export/shutdown
  • /software/cups/export/boottime

Problems and how to solve some of them

Many clients set a BrowsePoll print.cs= in cupsd.conf which can cause some traffic on print.cs. The parameter MaxClients in
has must be set larger than the number of clients polling the server.

Furthermore, because some clients are running older versions of cups, there are many orphaned cups-polld process on such clients which may or may not be doing polling of print.cs. To reduce the number of times clients request updated info from print.cs I recommend explicitly setting the BrowseInterval and BrowseTimeout parameters to larger values. Do ensure that that printers do not disappear you must have BrowseInterval < BrowseTimeout. I would suggest a value of an hour, i.e, 3600 (these parameters take seconds). And updating the host to a new version Ubuntu is also recommended.

See CupsOnLinux for specific notes on how to configure CUPS on Linux.

Printing on Frontends is Provided by CUPS server on print.cs

Both the core and undergraduate frontends get printing services by listening to the subnet for UDP packets broadcast by print.cs. Until a proper way of accounting for print jobs on the cups side can be done we will not be sending jobs directly to a printer albeit for printers where accounting is not an issue it may be permissible to do so.

Cups has been setup as a client on cscf.cs

I have installed the xhier cups-1.2.X package on cscf.cs. It can run at the

If you want to access the CUPS commands use the showpath command. Something like

   setenv PATH `/bin/showpath cups-1.2.X standard u=m`
if you are using csh or tcsh. Similarly you should setup the MANPATH environment variable so that the CUPS man pages are show first, namely
   setenv MANPATH `/bin/showpath class=man   cups standard`
if you are using csh or tcsh.

Cups Authentication Schemes

According to the developer of CUPS, any pam module can be used as long as CUPS is told to use them. In particular, the host services118.cs running Ubuntu has been configured to authenticate to the Windows ADS domain CS.UWATERLOO.CA via PAM. *NOTE. There are problems with this as it does not work at the moment. I may be forced to use setpw again but one can login as root from cscf.cs.*

On print.cs it uses Basic which means it's using /etc/passwd, /etc/shadow for administrative tasks.

Print Accounting

Software and Hardware Accounting

Simply put it is desired to have page counts. There are basically two approaches, namely software and hardware where the software approach analyzes the data files directly whereas the hardware approach tries to query the printer for page counts. The latter approach is most likely the desired statistic.

The cups server logs pages printed in logs/page_log and it represents a software approach. Tools exist to analyze this data and present it in a more understandable format. For example, screenshot using phpPrintAnalyzer.

A much more complete accounting suite for print accounting appears to be Pykota which can do both types of accounting. In addition to Pykota there are some specific tools like pkpgcounter which uses a software approach to get page counts. A user could use this to estimate the number pages (and cost) of a print job. I have created a deb package from the subversion archive and installed the package on my pc.

Authentication and Authorization to Print

Pykota uses a backend database to store it's records and also to restrict access to printers based on what user and usergroup. It can use SQLite3, PostgreSQL, MySQL, or LDAP.

MySQL as the backend

I have successfully set this up and I have used phpmyadmin to query it via a browser. Nice! MySQL has mindshare in CSCF albeit PostgreSQL is becoming more favoured.

PostgreSQL as the backend database

It is highly probable that postgresql will be the database of choice as it's truly robust database and because Pykota seems to work better with it.

Accessing Print Job History

Have also made it possible to present print job history for users via a cgi script that comes with Pykota. This script allows any user to see the job history of all users unless one uses htpasswd (this would entail enabling passwds for all users--not a viable option). There area also nice command line tools that yield the same information albeit we would have to enable some remote login facility to run certain commands like we do now with lpquota.


  • Make it possible to proper accounting like we currently do with lpquota_filter and psif
    • Done! Albeit a little more examination of how it does it may be in order, both for psif, lpquota_filter and Pykota
  • As part of the transition to cups we should make it possible to forward jobs to the cups server using our lpr command as provided by the xhier lpr package, see XhierLprToUbuntuCups for a solution.

External References about Cups

  • Slashdot discussions of Cups and other systems,

Edit | Attach | Watch | Print version | History: r20 < r19 < r18 < r17 < r16 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r20 - 2013-07-03 - DrewPilcher
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback