Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

Samba HowTo Guide
Prev Home Next

Manual Driver Installation in 15 Steps

We are going to install a printer driver now by manually executing all required commands. Because this may seem a rather complicated process at first, we go through the procedure step by step, explaining every single action item as it comes up.

Procedure21.2.Manual Driver Installation

  1. Install the printer on CUPS.

    	root# 
    
    lpadmin -p mysmbtstprn -v socket://10.160.51.131:9100 -E \
    				-P canonIR85.ppd
    
    	

    This installs a printer with the name mysmbtstprn to the CUPS system. The printer is accessed via a socket (a.k.a. JetDirect or Direct TCP/IP) connection. You need to be root for this step.

  2. (Optional.) Check if the printer is recognized by Samba.

    root# 
    
    rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
      | grep -C2 mysmbtstprn
    
    flags:[0x800000]
    name:[\\kde-bitshop\mysmbtstprn]
    description:[\\kde-bitshop\mysmbtstprn,,mysmbtstprn]
    comment:[mysmbtstprn]
    

    This should show the printer in the list. If not, stop and restart the Samba daemon (smbd) or send a HUP signal:

    root# 
    
    kill -HUP `pidof smbd`
    
    

    Check again. Troubleshoot and repeat until successful. Note the “empty” field between the two commas in the “description” line. The driver name would appear here if there was one already. You need to know root's Samba password (as set by the smbpasswd command) for this step and most of the following steps. Alternatively, you can authenticate as one of the users from the “write list” as defined in smb.conf for [print$] .

  3. (Optional.) Check if Samba knows a driver for the printer.

    root# 
    
    rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2'\
     localhost | grep driver 
    
    
    drivername:[]
    
    root# 
    
    rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' \
     localhost | grep -C4 driv
    
    
    servername:[\\kde-bitshop]
    printername:[\\kde-bitshop\mysmbtstprn]
    sharename:[mysmbtstprn]
    portname:[Samba Printer Port]
    drivername:[]
    comment:[mysmbtstprn]
    location:[]
    sepfile:[]
    printprocessor:[winprint]
     
    root# 
    
    rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost
    
     result was WERR_UNKNOWN_PRINTER_DRIVER
    

    None of the three commands shown above should show a driver. This step was done for the purpose of demonstrating this condition. An attempt to connect to the printer at this stage will prompt a message along the lines of, “The server does not have the required printer driver installed.

  4. Put all required driver files into Samba's [print$].

    root# 
    
    smbclient //localhost/print\$ -U 'root%xxxx' \
    	-c 'cd W32X86; \
    	put /etc/cups/ppd/mysmbtstprn.ppd mysmbtstprn.PPD; \ 
    	put /usr/share/cups/drivers/cupsui.dll cupsui.dll; \
    	put /usr/share/cups/drivers/cupsdrvr.dll cupsdrvr.dll; \
    	put /usr/share/cups/drivers/cups.hlp cups.hlp'
    
    

    (This command should be entered in one long single line. Line breaks and the line ends indicated by “\” have been inserted for readability reasons.) This step is required for the next one to succeed. It makes the driver files physically present in the [print$] share. However, clients would still not be able to install them, because Samba does not yet treat them as driver files. A client asking for the driver would still be presented with a “not installed here” message.

  5. Verify where the driver files are now.

    root# 
    
    ls -l /etc/samba/drivers/W32X86/
    
    total 669
    drwxr-sr-x    2 root     ntadmin       532 May 25 23:08 2
    drwxr-sr-x    2 root     ntadmin       670 May 16 03:15 3
    -rwxr--r--    1 root     ntadmin     14234 May 25 23:21 cups.hlp
    -rwxr--r--    1 root     ntadmin    278380 May 25 23:21 cupsdrvr.dll
    -rwxr--r--    1 root     ntadmin    215848 May 25 23:21 cupsui.dll
    -rwxr--r--    1 root     ntadmin    169458 May 25 23:21 mysmbtstprn.PPD
    

    The driver files now are in the W32X86 architecture “root” of [print$] .

  6. Tell Samba that these are driver files ( adddriver ).

    root# 
    
    rpcclient -Uroot%xxxx -c 'adddriver "Windows NT x86" \
    	"mydrivername:cupsdrvr.dll:mysmbtstprn.PPD: \
      cupsui.dll:cups.hlp:NULL:RAW:NULL"' \
      localhost
    
    Printer Driver mydrivername successfully installed.
    

    You cannot repeat this step if it fails. It could fail even as a result of a simple typo. It will most likely have moved a part of the driver files into the “2” subdirectory. If this step fails, you need to go back to the fourth step and repeat it before you can try this one again. In this step, you need to choose a name for your driver. It is normally a good idea to use the same name as is used for the printer name; however, in big installations you may use this driver for a number of printers that obviously have different names, so the name of the driver is not fixed.

  7. Verify where the driver files are now.

    root# 
    
    ls -l /etc/samba/drivers/W32X86/
    
    total 1
    drwxr-sr-x    2 root     ntadmin       532 May 25 23:22 2
    drwxr-sr-x    2 root     ntadmin       670 May 16 03:15 3
    
    root# 
    
    ls -l /etc/samba/drivers/W32X86/2
    
    total 5039
    [....]
    -rwxr--r--    1 root     ntadmin     14234 May 25 23:21 cups.hlp
    -rwxr--r--    1 root     ntadmin    278380 May 13 13:53 cupsdrvr.dll
    -rwxr--r--    1 root     ntadmin    215848 May 13 13:53 cupsui.dll
    -rwxr--r--    1 root     ntadmin    169458 May 25 23:21 mysmbtstprn.PPD
    

    Notice how step 6 also moved the driver files to the appropriate subdirectory. Compare this with the situation after step 5.

  8. (Optional.) Verify if Samba now recognizes the driver.

    root# 
    
    rpcclient -Uroot%xxxx -c 'enumdrivers 3' \
    	localhost | grep -B2 -A5 mydrivername
    
    Printer Driver Info 3:
    Version: [2]
    Driver Name: [mydrivername]
    Architecture: [Windows NT x86]
    Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
    Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
    Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
    Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
    

    Remember, this command greps for the name you chose for the driver in step 6. This command must succeed before you can proceed.

  9. <title>Tell Samba which printer should use these driver files ( setdriver ).</title>

    root# 
    
    rpcclient -Uroot%xxxx -c 'setdriver mysmbtstprn mydrivername' \
    	localhost
    
    Successfully set mysmbtstprn to driver mydrivername
    

    Since you can bind any printer name (print queue) to any driver, this is a convenient way to set up many queues that use the same driver. You do not need to repeat all the previous steps for the setdriver command to succeed. The only preconditions are that enumdrivers must find the driver and enumprinters must find the printer.

  10. (Optional) Verify if Samba has recognized this association.

    root# 
    
    rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
      | grep driver
    
    drivername:[mydrivername]
     
    root# 
    
    rpcclient -Uroot%xxxx -c 'getprinter mysmbtstprn 2' localhost \
      | grep -C4 driv
    
    servername:[\\kde-bitshop]
    printername:[\\kde-bitshop\mysmbtstprn]
    sharename:[mysmbtstprn]
    portname:[Done]
    drivername:[mydrivername]
    comment:[mysmbtstprn]
    location:[]
    sepfile:[]
    printprocessor:[winprint]
     
    root# 
    
    rpcclient -U root%xxxx -c 'getdriver mysmbtstprn' localhost
    
    [Windows NT x86]
    Printer Driver Info 3:
         Version: [2]
         Driver Name: [mydrivername]
         Architecture: [Windows NT x86]
         Driver Path: [\\kde-bitshop\print$\W32X86\2\cupsdrvr.dll]
         Datafile: [\\kde-bitshop\print$\W32X86\2\mysmbtstprn.PPD]
         Configfile: [\\kde-bitshop\print$\W32X86\2\cupsui.dll]
         Helpfile: [\\kde-bitshop\print$\W32X86\2\cups.hlp]
         Monitorname: []
         Defaultdatatype: [RAW]
         Monitorname: []
         Defaultdatatype: [RAW]
     
    root# 
    
    rpcclient -Uroot%xxxx -c 'enumprinters' localhost \
    	| grep mysmbtstprn
    
         name:[\\kde-bitshop\mysmbtstprn]
         description:[\\kde-bitshop\mysmbtstprn,mydrivername,mysmbtstprn]
         comment:[mysmbtstprn]
    
    

    Compare these results with the ones from steps 2 and 3. Every one of these commands show the driver is installed. Even the enumprinters command now lists the driver on the “description” line.

  11. (Optional.) Tickle the driver into a correct device mode.

    You certainly know how to install the driver on the client. In case you are not particularly familiar with Windows, here is a short recipe: Browse the Network Neighborhood, go to the Samba server, and look for the shares. You should see all shared Samba printers. Double-click on the one in question. The driver should get installed and the network connection set up. Another way is to open the Printers (and Faxes) folder, right-click on the printer in question, and select Connect or Install. As a result, a new printer should appear in your client's local Printers (and Faxes) folder, named something like printersharename on Sambahostname.

    It is important that you execute this step as a Samba printer admin (as defined in smb.conf). Here is another method to do this on Windows XP. It uses a command line, which you may type into the “DOS box” (type root's smbpassword when prompted):

    C:\> 
    
    runas /netonly /user:root "rundll32 printui.dll,PrintUIEntry \
    	/in /n \\sambaserver\mysmbtstprn"
    
    

    Change any printer setting once (like changing portrait to landscape ), click on Apply, and change the setting back.

  12. Install the printer on a client (Point'n'Print).

    C:\> 
    
    rundll32 printui.dll,PrintUIEntry /in /n "\\sambaserver\mysmbtstprn"
    
    

    If it does not work, it could be a permissions problem with the [print$] share.

  13. (Optional) Print a test page.

    C:\> 
    
    rundll32 printui.dll,PrintUIEntry /p /n "\\sambaserver\mysmbtstprn"
    
    

    Then hit [TAB] five times, [ENTER] twice, [TAB] once, and [ENTER] again, and march to the printer.

  14. (Recommended.) Study the test page.

    Hmmm. Just kidding! By now you know everything about printer installations and you do not need to read a word. Just put it in a frame and bolt it to the wall with the heading "MY FIRST RPCCLIENT-INSTALLED PRINTER" why not just throw it away!

  15. (Obligatory.) Enjoy. Jump. Celebrate your success.

    root# 
    
    echo "Cheeeeerioooooo! Success..." >> /var/log/samba/log.smbd
    
    
Samba HowTo Guide
Prev Home Next

 
 
  Published under the terms fo the GNU General Public License Design by Interspire