18.10 Configuring CUPS for Driver Download


As we have said before, all previously known methods to prepare client printer drivers on the Samba server for download and Point'n'Print convenience of Windows workstations are working with CUPS, too. These methods were described in the previous chapter. In reality, this is a pure Samba business and only relates to the Samba/Windows client relationship.

18.10.1 cupsaddsmb : The Unknown Utility

The cupsaddsmb utility (shipped with all current CUPS versions) is an alternate method to transfer printer drivers into the Samba [print$] share. Remember, this share is where clients expect drivers deposited and setup for download and installation. It makes the sharing of any (or all) installed CUPS printers quite easy. cupsaddsmb can use the Adobe PostScript driver as well as the newly developed CUPS PostScript Driver for Windows NT/200x/XP. cupsaddsmb does not work with arbitrary vendor printer drivers, but only with the exact driver files that are named in its man page.

The CUPS printer driver is available from the CUPS download site. Its package name is cups-samba-[version].tar.gz . It is preferred over the Adobe drivers since it has a number of advantages:

  • It supports a much more accurate page accounting.

  • It supports banner pages, and page labels on all printers.

  • It supports the setting of a number of job IPP attributes (such as job-priority, pagelabel and job-billing).

However, currently only Windows NT, 2000 and XP are supported by the CUPS drivers. You will also need to get the respective part of Adobe driver if you need to support Windows 95, 98 and ME clients.

18.10.2 Prepare Your smb.conf for cupsaddsmb

Prior to running cupsaddsmb , you need the settings in smb.conf as shown in Example 18.3:

18.10.3 CUPS " PostScript Driver for Windows NT/200x/XP "

CUPS users may get the exact same packages from http://www.cups.org/software.html. It is a separate package from the CUPS base software files, tagged as CUPS 1.1.x Windows NT/200x/XP Printer Driver for Samba (tar.gz, 192k). The filename to download is cups-samba-1.1.x.tar.gz . Upon untar and unzipping, it will reveal these files:

 
 root# tar xvzf cups-samba-1.1.19.tar.gz cups-samba.install cups-samba.license cups-samba.readme cups-samba.remove 
Example 18.3 smb.conf for cupsaddsmb usage
  [global]   load printers = yes   printing = cups   printcap name = cups   [printers]   comment = All Printers   path = /var/spool/samba   browseable = no   public = yes  # setting depends on your requirements  guest ok = yes   writable = no   printable = yes   printer admin = root   [print$]   comment = Printer Drivers   path = /etc/samba/drivers   browseable = yes   guest ok = no   read only = yes   write list = root  
 
 cups-samba.ss 

These have been packaged with the ESP meta packager software EPM. The *.install and *.remove files are simple shell scripts, which untars the *.ss (the *.ss is nothing else but a tar-archive, which can be untarred by " tar " too). Then it puts the content into /usr/share/cups/drivers/ . This content includes three files:

 
 root# tar tv cups-samba.ss cupsdrvr.dll cupsui.dll cups.hlp 

The cups-samba.install shell scripts are easy to handle:

 
 root# ./cups-samba.install [....] Installing software... Updating file permissions... Running post-install commands... Installation is complete. 

The script should automatically put the driver files into the /usr/share/cups/drivers/ directory.

W ARNING

graphics/exclamatory.gif

Due to a bug, one recent CUPS release puts the cups.hlp driver file into /usr/share/drivers/ instead of /usr/share/cups/drivers/ . To work around this, copy/move the file (after running the ./cups-samba.install script) manually to the correct place.


 
 root# cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/ 

This new CUPS PostScript driver is currently binary-only, but free of charge. No complete source code is provided (yet). The reason is that it has been developed with the help of the Microsoft Driver Developer Kit (DDK) and compiled with Microsoft Visual Studio 6. Driver developers are not allowed to distribute the whole of the source code as free software. However, CUPS developers released the " diff " in source code under the GPL, so anybody with a license of Visual Studio and a DDK will be able to compile for him/herself.

18.10.4 Recognizing Different Driver Files

The CUPS drivers do not support the older Windows 95/98/Me, but only the Windows NT/2000/XP client.

Windows NT, 2000 and XP are supported by:

  • cups.hlp

  • cupsdrvr.dll

  • cupsui.dll

Adobe drivers are available for the older Windows 95/98/Me as well as the Windows NT/2000/XP clients. The set of files is different from the different platforms.

Windows 95, 98 and ME are supported by:

  • ADFONTS.MFM

  • ADOBEPS4.DRV

  • ADOBEPS4.HLP

  • DEFPRTR2.PPD

  • ICONLIB.DLL

  • PSMON.DLL

Windows NT, 2000 and XP are supported by:

  • ADOBEPS5.DLL

  • ADOBEPSU.DLL

  • ADOBEPSU.HLP

N OTE

graphics/round_pencil.gif

If both the Adobe driver files and the CUPS driver files for the support of Windows NT/200x/XP are present in FIXME, the Adobe ones will be ignored and the CUPS ones will be used. If you prefer for whatever reason to use Adobe-only drivers, move away the three CUPS driver files. The Windows 9x/Me clients use the Adobe drivers in any case.


18.10.5 Acquiring the Adobe Driver Files

Acquiring the Adobe driver files seems to be unexpectedly difficult for many users. They are not available on the Adobe Web site as single files and the self-extracting and/or self-installing Windows-.exe is not easy to locate either. Probably you need to use the included native installer and run the installation process on one client once. This will install the drivers (and one Generic PostScript printer) locally on the client. When they are installed, share the Generic PostScript printer. After this, the client's [print$] share holds the Adobe files, from where you can get them with smbclient from the CUPS host.

18.10.6 ESP Print Pro PostScript Driver for Windows NT/200x/XP

Users of the ESP Print Pro software are able to install their Samba drivers package for this purpose with no problem. Retrieve the driver files from the normal download area of the ESP Print Pro software at http://www.easysw.com/software.html. You need to locate the link labelled " SAMBA " among the Download Printer Drivers for ESP Print Pro 4.x area and download the package. Once installed, you can prepare any driver by simply highlighting the printer in the Printer Manager GUI and select Export Driver... from the menu. Of course you need to have prepared Samba beforehand to handle the driver files; i.e., setup the [print$] share, and so on. The ESP Print Pro package includes the CUPS driver files as well as a (licensed) set of Adobe drivers for the Windows 95/98/Me client family.

18.10.7 Caveats to be Considered

Once you have run the install script (and possibly manually moved the cups.hlp file to /usr/share/cups/drivers/ ), the driver is ready to be put into Samba's [print$] share (which often maps to /etc/samba/drivers/ and contains a subdirectory tree with WIN40 and W32X86 branches). You do this by running cupsaddsmb (see also man cupsaddsmb for CUPS since release 1.1.16).

T IP

graphics/hand.gif

You may need to put root into the smbpasswd file by running smbpasswd ; this is especially important if you should run this whole procedure for the first time, and are not working in an environment where everything is configured for single sign on to a Windows Domain Controller.


Once the driver files are in the [print$] share and are initialized , they are ready to be downloaded and installed by the Windows NT/200x/XP clients.

N OTE

graphics/round_pencil.gif

Win 9x/Me clients will not work with the CUPS PostScript driver. For these you still need to use the ADOBE*.* drivers as previously stated.


N OTE

graphics/round_pencil.gif

It is not harmful if you still have the ADOBE*.* driver files from previous installations in the /usr/share/cups/drivers/ directory. The new cupsaddsmb (from 1.1.16) will automatically prefer its own drivers if it finds both.


N OTE

graphics/round_pencil.gif

Should your Windows clients have had the old ADOBE*.* files for the Adobe PostScript driver installed, the download and installation of the new CUPS PostScript driver for Windows NT/200x/XP will fail at first. You need to wipe the old driver from the clients first. It is not enough to " delete " the printer, as the driver files will still be kept by the clients and re-used if you try to re-install the printer. To really get rid of the Adobe driver files on the clients, open the Printers folder (possibly via Start > Settings > Control Panel > Printers ), right-click on the folder background and select Server Properties . When the new dialog opens, select the Drivers tab. On the list select the driver you want to delete and click the Delete button. This will only work if there is not one single printer left that uses that particular driver. You need to " delete " all printers using this driver in the Printers folder first. You will need Administrator privileges to do this.


N OTE

graphics/round_pencil.gif

Once you have successfully downloaded the CUPS PostScript driver to a client, you can easily switch all printers to this one by proceeding as described in Chapter 17, Classical Printing Support . Either change a driver for an existing printer by running the Printer Properties dialog, or use rpcclient with the setdriver subcommand.


18.10.8 Windows CUPS PostScript Driver Versus Adobe Driver

Are you interested in a comparison between the CUPS and the Adobe PostScript drivers? For our purposes these are the most important items that weigh in favor of the CUPS ones:

  • No hassle with the Adobe EULA.

  • No hassle with the question " Where do I get the ADOBE*.* driver files from? "

  • The Adobe drivers (on request of the printer PPD associated with them) often put a PJL header in front of the main PostScript part of the print file. Thus, the printfile starts with < 1B > %-12345X or < escape > %-12345X instead of %!PS ). This leads to the CUPS daemon auto-typing the incoming file as a print-ready file, not initiating a pass through the pstops filter (to speak more technically, it is not regarded as the generic MIME-type application/postscript , but as the more special MIME type application/cups.vnd-postscript ), which therefore also leads to the page accounting in /var/log/cups/page_log not receiving the exact number of pages; instead the dummy page number of " 1 " is logged in a standard setup).

  • The Adobe driver has more options to misconfigure the PostScript generated by it (like setting it inadvertently to Optimize for Speed , instead of Optimize for Portability , which could lead to CUPS being unable to process it).

  • The CUPS PostScript driver output sent by Windows clients to the CUPS server is guaranteed to auto-type as the generic MIME type application/postscript , thus passing through the CUPS pstops filter and logging the correct number of pages in the page_log for accounting and quota purposes.

  • The CUPS PostScript driver supports the sending of additional standard (IPP) print options by Windows NT/200x/XP clients. Such additional print options are: naming the CUPS standard banner pages (or the custom ones, should they be installed at the time of driver download), using the CUPS page-label option, setting a job-priority, and setting the scheduled time of printing (with the option to support additional useful IPP job attributes in the future).

  • The CUPS PostScript driver supports the inclusion of the new *cupsJobTicket comments at the beginning of the PostScript file (which could be used in the future for all sort of beneficial extensions on the CUPS side, but which will not disturb any other applications as they will regard it as a comment and simply ignore it).

  • The CUPS PostScript driver will be the heart of the fully fledged CUPS IPP client for Windows NT/200x/XP to be released soon (probably alongside the first beta release for CUPS 1.2).

18.10.9 Run cupsaddsmb (Quiet Mode)

The cupsaddsmb command copies the needed files into your [print$] share. Additionally, the PPD associated with this printer is copied from /etc/cups/ppd/ to [print$] . There the files wait for convenient Windows client installations via Point'n'Print. Before we can run the command successfully, we need to be sure that we can authenticate toward Samba. If you have a small network, you are probably using user -level security ( security = user).

Here is an example of a successfully run cupsaddsmb command:

 
 root# cupsaddsmb -U root infotec_IS2027 Password for root required to access localhost via Samba: ['secret'] 

To share all printers and drivers, use the -a parameter instead of a printer name. Since cupsaddsmb " exports " the printer drivers to Samba, it should be obvious that it only works for queues with a CUPS driver associated.

18.10.10 Run cupsaddsmb with Verbose Output

Probably you want to see what's going on. Use the -v parameter to get a more verbose output. The output below was edited for better readability: all "\" at the end of a line indicate that I inserted an artificial line break plus some indentation here:

W ARNING

graphics/exclamatory.gif

You will see the root password for the Samba account printed on screen.


 
 root# cupsaddsmb -U root -v infotec_2105 Password for root required to access localhost via GANDALF: Running command: smbclient //localhost/print\$ -N -U'root%secret' \ -c 'mkdir W32X86; \ put /var/spool/cups/tmp/3e98bf2d333b5 W32X86/infotec_2105.ppd; \ put /usr/share/cups/drivers/cupsdrvr.dll W32X86/cupsdrvr.dll; \ put /usr/share/cups/drivers/cupsui.dll W32X86/cupsui.dll; \ put /usr/share/cups/drivers/cups.hlp W32X86/cups.hlp' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \W32X86/infotec_2105.ppd putting file /usr/share/cups/drivers/cupsdrvr.dll as \W32X86/cupsdrvr.dll putting file /usr/share/cups/drivers/cupsui.dll as \W32X86/cupsui.dll putting file /usr/share/cups/drivers/cups.hlp as \W32X86/cups.hlp Running command: rpcclient localhost -N -U'root%secret' -c 'adddriver "Windows NT x86" \ "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ RAW:NULL" cmd = adddriver "Windows NT x86" \ "infotec_2105:cupsdrvr.dll:infotec_2105.ppd:cupsui.dll:cups.hlp:NULL: \ RAW:NULL" Printer Driver infotec_2105 successfully installed. Running command: smbclient //localhost/print\$ -N -U'root%secret' \ -c 'mkdir WIN40; \ put /var/spool/cups/tmp/3e98bf2d333b5 WIN40/infotec_2105.PPD; \ put /usr/share/cups/drivers/ADFONTS.MFM WIN40/ADFONTS.MFM; \ put /usr/share/cups/drivers/ADOBEPS4.DRV WIN40/ADOBEPS4.DRV; \ put /usr/share/cups/drivers/ADOBEPS4.HLP WIN40/ADOBEPS4.HLP; \ put /usr/share/cups/drivers/DEFPRTR2.PPD WIN40/DEFPRTR2.PPD; \ put /usr/share/cups/drivers/ICONLIB.DLL WIN40/ICONLIB.DLL; \ put /usr/share/cups/drivers/PSMON.DLL WIN40/PSMON.DLL;' added interface ip=10.160.51.60 bcast=10.160.51.255 nmask=255.255.252.0 Domain=[CUPS-PRINT] OS=[UNIX] Server=[Samba 2.2.7a] NT_STATUS_OBJECT_NAME_COLLISION making remote directory \WIN40 putting file /var/spool/cups/tmp/3e98bf2d333b5 as \WIN40/infotec_2105.PPD putting file /usr/share/cups/drivers/ADFONTS.MFM as \WIN40/ADFONTS.MFM putting file /usr/share/cups/drivers/ADOBEPS4.DRV as \WIN40/ADOBEPS4.DRV putting file /usr/share/cups/drivers/ADOBEPS4.HLP as \WIN40/ADOBEPS4.HLP putting file /usr/share/cups/drivers/DEFPRTR2.PPD as \WIN40/DEFPRTR2.PPD putting file /usr/share/cups/drivers/ICONLIB.DLL as \WIN40/ICONLIB.DLL putting file /usr/share/cups/drivers/PSMON.DLL as \WIN40/PSMON.DLL Running command: rpcclient localhost -N -U'root%secret' \ -c 'adddriver "Windows 4.0" \ "infotec_2105:ADOBEPS4.DRV:infotec_2105.PPD:NULL:ADOBEPS4.HLP: \ PSMON.DLL:RAW:ADOBEPS4.DRV,infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL, \ ADFONTS.MFM,DEFPRTR2.PPD,ICONLIB.DLL"' cmd = adddriver "Windows 4.0" "infotec_2105:ADOBEPS4.DRV: \ infotec_2105.PPD:NULL:ADOBEPS4.HLP:PSMON.DLL:RAW:ADOBEPS4.DRV,\ infotec_2105.PPD,ADOBEPS4.HLP,PSMON.DLL,ADFONTS.MFM,DEFPRTR2.PPD,\ ICONLIB.DLL" Printer Driver infotec_2105 successfully installed. Running command: rpcclient localhost -N -U'root%secret' \ -c 'setdriver infotec_2105 infotec_2105' cmd = setdriver infotec_2105 infotec_2105 Successfully set infotec_2105 to driver infotec_2105. 

If you look closely, you'll discover your root password was transferred unencrypted over the wire, so beware! Also, if you look further, you'll discover error messages like NT_STATUS_OBJECT_NAME_COLLISION in between. They occur, because the directories WIN40 and W32X86 already existed in the [print$] driver download share (from a previous driver installation). They are harmless here.

18.10.11 Understanding cupsaddsmb

What has happened ? What did cupsaddsmb do? There are five stages of the procedure:

  1. Call the CUPS server via IPP and request the driver files and the PPD file for the named printer.

  2. Store the files temporarily in the local TEMPDIR (as defined in cupsd.conf ).

  3. Connect via smbclient to the Samba server's [print$] share and put the files into the share's WIN40 (for Windows 9x/Me) and W32X86/ (for Windows NT/200x/XP) subdirectories.

  4. Connect via rpcclient to the Samba server and execute the adddriver command with the correct parameters.

  5. Connect via rpcclient to the Samba server a second time and execute the setdriver command.

N OTE

graphics/round_pencil.gif

You can run the cupsaddsmb utility with parameters to specify one remote host as Samba host and a second remote host as CUPS host. Especially if you want to get a deeper understanding, it is a good idea to try it and see more clearly what is going on (though in real life most people will have their CUPS and Samba servers run on the same host):

 
 root# cupsaddsmb -H sambaserver -h cupsserver -v printer 

18.10.12 How to Recognize If cupsaddsmb Completed Successfully

You must always check if the utility completed successfully in all fields. You need as a minimum these three messages among the output:

  1. Printer Driver infotec_2105 successfully installed . # (for the W32X86 == Windows NT/200x/XP architecture).

  2. Printer Driver infotec_2105 successfully installed . # (for the WIN40 == Windows 9x/Me architecture).

  3. Successfully set [printerXPZ] to driver [printerXYZ] .

These messages are probably not easily recognized in the general output. If you run cupsaddsmb with the -a parameter (which tries to prepare all active CUPS printer drivers for download), you might miss if individual printers drivers had problems installing properly. Here a redirection of the output will help you analyze the results in retrospective.

N OTE

graphics/round_pencil.gif

It is impossible to see any diagnostic output if you do not run cupsaddsmb in verbose mode. Therefore, we strongly recommend to not use the default quiet mode. It will hide any problems from you that might occur.


18.10.13 cupsaddsmb with a Samba PDC

Can't get the standard cupsaddsmb command to run on a Samba PDC? Are you asked for the password credential all over again and again and the command just will not take off at all? Try one of these variations:

 
 root# cupsaddsmb -U MIDEARTH\\root -v printername root# cupsaddsmb -H SAURON -U MIDEARTH\\root -v printername root# cupsaddsmb -H SAURON -U MIDEARTH\\root -h cups-server -v printername 

(Note the two backslashes: the first one is required to " escape " the second one).

18.10.14 cupsaddsmb Flowchart

Figure 18.16 shows a chart about the procedures, commandflows and dataflows of the cupaddsmb command. Note again: cupsaddsmb is not intended to, and does not work with, raw queues!

Figure 18.16. cupsaddsmb flowchart.

graphics/18fig16.jpg

18.10.15 Installing the PostScript Driver on a Client

After cupsaddsmb is completed, your driver is prepared for the clients to use. Here are the steps you must perform to download and install it via Point'n'Print. From a Windows client, browse to the CUPS/Samba server:

  • Open the Printers share of Samba in Network Neighborhood.

  • Right-click on the printer in question.

  • From the opening context-menu select Install... or Connect... (depending on the Windows version you use).

After a few seconds, there should be a new printer in your client's local Printers folder. On Windows XP it will follow a naming convention of PrinterName on SambaServer . (In my current case it is "infotec_2105 on kde-bitshop"). If you want to test it and send your first job from an application like Winword, the new printer appears in a \\SambaServer\PrinterName entry in the drop-down list of available printers.

cupsaddsmb will only reliably work with CUPS version 1.1.15 or higher and Samba from 2.2.4. If it does not work, or if the automatic printer driver download to the clients does not succeed, you can still manually install the CUPS printer PPD on top of the Adobe PostScript driver on clients. Then point the client's printer queue to the Samba printer share for a UNC type of connection:

 
 C:\> net use lpt1: \\sambaserver\printershare /user: ntadmin 

should you desire to use the CUPS networked PostScript RIP functions. (Note that user " ntadmin " needs to be a valid Samba user with the required privileges to access the printershare.) This sets up the printer connection in the traditional LanMan way (not using MS-RPC).

18.10.16 Avoiding Critical PostScript Driver Settings on the Client

Printing works, but there are still problems. Most jobs print well, some do not print at all. Some jobs have problems with fonts, which do not look very good. Some jobs print fast and some are dead-slow. Many of these problems can be greatly reduced or even completely eliminated if you follow a few guidelines. Remember, if your print device is not PostScript-enabled, you are treating your Ghostscript installation on your CUPS host with the output your client driver settings produce. Treat it well:

  • Avoid the PostScript Output Option: Optimize for Speed setting. Use the Optimize for Portability instead (Adobe PostScript driver).

  • Don't use the Page Independence: NO setting. Instead, use Page Independence YES (CUPS PostScript Driver).

  • Recommended is the True Type Font Downloading Option: Native True Type over Automatic and Outline; you should by all means avoid Bitmap (Adobe PostScript Driver).

  • Choose True Type Font: Download as Softfont into Printer over the default Replace by Device Font (for exotic fonts, you may need to change it back to get a printout at all) (Adobe).

  • Sometimes you can choose PostScript Language Level: In case of problems try 2 instead of 3 (the latest ESP Ghostscript package handles Level 3 PostScript very well) (Adobe).

  • Say Yes to PostScript Error Handler (Adobe).



Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net