Printing from Linux to a Windows Shared Printer
7 May 2006After a couple of weeks of trying various configuration combinations, I finally was able to print from my Linux box to a shared printer on my Win XP box. It took a long time and I'm still not entirely sure what I did to make it work. As I've mentioned before, this continues to be one of the disadvantages of Linux — it's very hard to get everything configured correctly. That said, I'm working on an eight year old Dell so that may be some of the problem. Also, my printer a Canon i960 didn't have a Linux print driver, which further complictes the problem. But, that is still the main difference between Windows and Linux. Windows provides a tremendous range of support for hardware and it generally automatically finds and sets up the hardware. Linux isn't there yet, but is improving. Anyway back to my printer problem.
After getting the Linux and XP boxes networked together using Samba, I embarked on the task of trying to print to a shared printer on the XP box from the Linux box. Most of the documentation made this sound easy, especially since I was planning on using Samba and CUPS, the defacto standard printing system for Linux.
At first, the set up went normal. I used Debian and Windows Shared Printing mini-HowTo to get started. Everything was going fine. Samba was able to recognize the shared printers on my XP box and I figured it would be quite simple to use CUPS to set up a shared printer. Then I ran into printer driver problems. Since there was no designated driver for the Canon i960, I guessed at a couple just to see if they would work. Nothing.
So, I searched the web and found this reference for getting a useable printer driver for the Canon i960. Once I'd downloaded the driver, I had to figure out how to get CUPS to recognize it. That took me into the world of Foomatic and Gimp-print. But, I wasn't real successful at figuring out how they work. Eventually, I was able to insert the Canon PPD file into the correct place (/usr/share/cups/model) so I could set up the printer in CUPS using this driver. After doing that, still no luck at printing a test page over the network.
I decided that maybe the print driver wasn't correct and the only way to check that was to connect the printer to the Linux box and install it locally. So, I made the big shuffle, installed the printer and tried to print a test page. At last, a small success. The test page printed. Now I was on the right track. I had the correct printer driver. Samba could see my printer shares on the Win XP box. Everything should work, right? After reconnecting the printer to the Win XP box and reconfiguring Samba and CUPS to recognize a Win XP printer, still no luck. I'd print a test page in CUPS and everything would look fine. The CUPS job page showed the job being completed and there was no indication that the file being printed was not being transmitted over the network.
In my several days of frustration, I also tried using KDEPrint, which you can access at Menu, Settings. It's called Printing Manager. YOu can also get to it from the KDE Control Center under Peripherals. When configuring printers under KDEPrint, there are a lot more choices for printer drivers than with CUPS. But, I still wasn't able to print to the XP shared printer.
Much online research turned up any number of variations on how to configure CUPS and Samba for printing from Linux to a Win printer. I kept fiddling with the setting until finally after about a week of trying, it worked. Unfortunately, I can't say what was the exact setting that made this happen. I had hoped this blog would be more definitive, but in this case it was just not possible. I suspect others end up in the same situation because when searching online, I found many post in numerous forums where setting up printers was a problem. About all I can do for anyone who is looking for answers is post my /etc/samba/smb.conf file at the bottom of this post.
Based on my experience, I can only offer two pieces of advice. First, if you're running Linux and in the market for a new printer, do some research first and find out which one is best supported for Linux. The second is to be prepared to spend some time learning about printers and printer drivers if you're using a printer that doesn't have a lot of Linux support. I hope my configuration 'holds,' but I expect there will be more problems in the future. That is normally the case when a problem gets solved, but there is no apparent reason for the solution. But, heh, that is why I'm spending this time to learn about Linux and all of this troubleshooting and research is helping me feel much more comfortable with Linux. Next, I want to delve into file systems and see if I can't figure out how to read and write from Linux to an NTFS partition. Also, sound isn't working on my Linux box so I'll have to research that, too. Stay tuned! Will let you know what happens.
My smb.conf file:
# Global parameters
[global]
workgroup = HOME
server string = %h server (Samba %v)
obey pam restrictions = Yes
passdb backend = tdbsam, guest
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n .
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
printcap name = cups
dns proxy = No
wins support = Yes
panic action = /usr/share/samba/panic-action %d
printing = cups
print command =
lpq command = %p
lprm command =
[printers]
comment = All Printers
path = /var/spool/samba
printer admin = root, @ntadmins
create mask = 0700
guest ok = Yes
printable = Yes
browseable = No
[print$]
comment = Printer Driver Download Area
path = /etc/samba/drivers
write list = @ntadmins, root
guest ok = Yes
[canon-local-working]
comment = CANON BJC-8200
path = /var/spool/samba
printer admin = root, @ntadmins
read only = No
create mask = 0700
guest ok = Yes
printable = Yes
printer name = canon-local-working
use client driver = Yes
oplocks = No
share modes = No
No comments yet