Posted by Anonymous on Mon 31 Jul 2006 at 11:07
Setting a printer in Debian Sarge from scratch and make it available for Windows XP clients on a LAN can be difficult, but using CUPS and samba it should be fairly straightforward if you have a supported printer. Here we will demonstrate how to do this.
Printing for the first time in a machine with a fresh install of Debian Sarge is not as easy as one might think. I came across many documents and web pages in the Internet that explain in a general way what I was trying to do, but none of them alone solved my problems and sometimes I didn't find what I was looking for in any of them. So, I wrote this guide to remember the solution to my problem and to share it with other people. This guide details all the problems I went trough -and the solutions – to make my printer available in my home's LAN. The LAN is formed by five PCs: Three desktops and two laptops. The machine running Debian Sarge is my own computer and the others, including laptops, run Windows XP. The printer is an old Epson Stylus Color 777.
Part 1: The Nightmare
First we must make sure we can print from the Debian Sarge PC to the printer attached to it. We must install and configure CUPS -the Common Unix Printing System- and for that we need to install the next packages that -as weird as it sounds- are not installed by default in a fresh desktop install of Sarge:
Besides these packages, Synaptic selected the next packages or they were already installed:
Finally, this package is necessary or Mozilla Thunderbird won't print at all:
The packages can be installed usingSynaptic or using the apt-get command as usual for Debian.
Once CUPS is installed we can add the printer. This can be done from a web browser opening the address http://localhost:631/ or from the KDE Control Center. The first problem hits us when we try to add the printer using the Control Center and in the part where we are supposed to choose the printer port we don't find lp0, the parallel port, but unknown-parallel0 We choose that option anyway and of course it doesn't work, the printer doesn't print a single character.
After a lot of time searching in Google and discovering a lot of people with the same problem but different solutions, we try some of them and discover that what is missing is the lp module in the kernel. So, we edit the file /etc/modules and add in a new line.
After rebooting (ok, I know you don't need to reboot to load a module, humor me) the port lp0 appears in the KDE Control Center. We use it again to add the printer in lp0 and choose the right driver. In this case the driver:
Epson Stylus Color 777 -CUPS+Gimp-Print v4.2.7
In the bottom part of the Control Center we can see the option "Print System Currently Used" and we change it to "CUPS". The printer must NOT be configured as RAW and we can leave "USER ACCESS SETTINGS" blank. Finally as the printer name we type StylusColor777. That should be all and really excited we open any program, try to print and...nothing, zero, no error messages, no badly printed pages, nothing. The programs seem to print well but the printer doesn't move at all. This is really discouraging because there are no error messages and we have not a single clue of what is happening. We loose an entire day searching solutions in the Internet. There are several people with the same problem but not a working solution, nobody knows how to fix this.
Keep in mind that this is a fresh install of Sarge. Amazing! Finally, fooling around the directories and files we open the file /var/log/cups/error_log and discover the following lines appear each time we try to print:
E [22/Oct/2005:13:29:58 -0500] Unable to convert file 0 to printable format for job 6! I [22/Oct/2005:13:29:58 -0500] Hint: Do you have ESP Ghostscript installed?
We do a Google search for ESP Ghostscript and discover it refers to the package gs-esp (the Ghostscript PostScript interpreter - ESP version) that OF COURSE is not installed. We proceed to install it using:
apt-get install gs-esp
What is this program supposed to do? Here is part of the package description which explains:
Ghostscript is used for PostScript preview and printing. Usually as a back-end to a program such as ghostview, it can display postscript documents in an X11 environment. Furthermore, it can render PostScript files as graphics to be printed on non-PostScript printers. Supported printers include common dot-matrix, inkjet and laser models.
We try to print a page... works perfectly! Two days lost but it is worth it! To this point we see that all the errors seem to be the distribution's fault. gs-esp should have been installed along with CUPS and lp not installed by default seems to be a hardware detection problem. From now on, we can print locally from the Debian Sarge PC.
Note: The Gimp needs to be configured independently from CUPS to print or it will only print random characters. In this case you only have to start the program, go to the 'Print' menu and choose the right driver and type of paper.
Part 2: Make the printer available using SAMBA
This task was another nightmare. The goal was to make the printer available to the Windows XP clients using SAMBA in anonymous form, this means the Windows XP clients don't need to use a login or password. (This is because my parents and brothers are the users and they don't seem to be able to memorize a password.)
Making the printer available requires three thing: CUPS configuration, SAMBA reconfiguration, and the configuration of each client with Windows XP installing the right drivers.
CUPS Configuration
After a lot of searching on the Internet and trying several times to access the printer from the windows clients - the printer doesn't appear at all in the LAN we discover that we must modify the file /etc/cups/cupsd.conf and add the line:
Allow From 192.168.1.*
This IP address may change with a different router. This will tell CUPS to accept printing from any machine connected to the local network.
Next, we must configure CUPS to allow printing in a RAW format from the Windows clients. For that we must modify two files: The first one is the file /etc/cups/mime.convs where we must uncomment the following line :
application/octet-stream application/vnd.cups-raw 0 -
The second change we must make is in the file /etc/cups/mime.types where we must uncomment the following line:
application/octet-stream
SAMBA Configuration
The next step is to configure SAMBA by modifying the file /etc/samba/smb.conf.
The file smb.conf in my computer is the next one:
[global] workgroup = KAMEHOUSE netbios name = HARPIA security = share #this section is only to share the printer printcap name = cups disable spoolss = Yes show add printer wizard = No printing = cups [printers] comment = Printer in Linux path = /var/spool/samba guest ok = Yes printable = Yes use client driver = Yes browseable = No
This example of smb.conf works perfectly and we will comment on it in a moment. The notable fact is that if we try to print from any Windows XP machine we won't get anything at all, only another error. We locate the problem when we check the file /var/log/samba/log.smbd:
'/var/spool/samba' does not exist or is not a directory, when connecting to [StylusColor777]
That's true. Even when SAMBA's official documentation and all examples that we find around show "path=/var/spool/samba" as the spool directory, this directory is not created in Sarge when SAMBA is installed!!! So we create it with:
# mkdir /var/spool/samba
Aditionally we must give to it the necessary rights so that the Windows clients can write to it:
# chmod 777 /var/spool/samba
This must be done because when a printer job arrives to a SAMBA server, the information is written temporarily in the directory specified by the option 'path' in the 'printers' section of smb.conf. SAMBA then executes a command to send this information to the printer.
Now some comments about the file smb.conf. The important sections for printers are [global] and [printers]
workgroup = KAMEHOUSE
The workgroup must be the same workgroup of the Windows XP machines.
netbios name = HARPIA
Here we set the netbios name of the Linux server in the Windows XP network
It is important that we specify cups with:
printcap name = cups
This is the way in which SAMBA tells Windows the name of the printer available in CUPS. If we don't use 'cups' we will see in the file /var/log/samba/log.smbd the error message:
Unable to get jobs for ipp://localhost/printers/lp client-error-not-found
Windows Client Configuration
The steps to configure the machines with Windows XP are demonstrated in the following screenshots.
If everything has been configured properly and the printer works then it will appear automatically. The drivers to use are the Windows XP native drivers or the ones in the printer install CD. The process must be repeated en each of the Windows XP machines. At the end you should be able to print from any of these machines. Even from the wireless connected laptops.

You must choose the network printer not a locally attached one.

If everything has been properly configured in Debian Sarge the printer must be available when you choose 'Browse for a printer'.

Note that the printer appears with its CUPS name, in this case StylusColor777

You can choose to make it the default printer or not:


Here we must choose the driver for the model of the printer. If Windows XP doesn't have the driver we must use the printer installation CD. If there are no drivers available for the printer you can select the drivers for a postscript printer. For example Apple Laserwriter o the Postscript driver from Adobe (available on their web site), if it is a color printer you can choose Apple Color Laserwriter. The drivers may print with a little less resolution but they work. This is because everything is send as postscript to CUPS and CUPS understands postscript just fine. This has a big advantage,if you have an old printer that doesn't have drivers for Windows anymore, you can use it just fine in the network if it works in Linux.


This is the last step and the Windows machine will be able to print to the Linux server.

This is pretty useful, isn't it? It took me a couple of days but I learned a lot about CUPS and SAMBA, specially looking at the log files. Next time I'll bring another piece to the puzzle, how to print to a printer connected to one of the Windows XP machines from the Debian Sarge PC.
by Cesar Chaparro
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
[ Parent ]
XP can do printing direct to cups.
This what is called ipp internet printing protocol. just use
ipp://yourdebianhost:631/printers/Yourprintersnamehere
voila you can use it.
Aehm and you can also use a anonymous account for cups under XP.
You also dont need any postscript-adobe driver.
just give the /etc/cups/???/yourprinter.ppd to your client.
[ Parent ]