Sunday, November 14, 2004

cups & samba vs windows XP printing

So I just spent a couple of hours fighting with my linux server and printing to the attached printer from my windows boxen. So that I don't forget it when it breaks again, and for the sake of the world’s best troubleshooting database, I'm going to write it down here. If you don't at all care about printing to a linux-connected printer from a windows client, you can stop reading here. No, really, it just gets geekier from here on in.

Summary: You can print from windows XP to a linux printer using cups & samba via IPP or windows networking. The key step is enabling raw printing, by uncommenting the application/octet-stream lines at the bottom of the files /etc/cups/mime.*. Read on for the story of how I achieved it.

My file server in the corner is running Fedora Core 1 and happily serving up files via NFS and Samba. I've got an HP DeskJet 3650 connected to it via USB, and I wanted to be able to print to it from the 3 other machines (all running windows XP) in my house. It was working until I rebooted the server, and because I had no idea what I'd done to it, I decided to set it up from scratch. It turns out there's two ways to do it - via samba and shared via IPP; I did both, and I liked the IPP results better1, but I'll talk about both here. After plugging in a monitor, mouse & keyboard so I could get a console, here's what I did:

  1. Plugged the printer in. /var/log/messages registered some garbage about a new USB device; that's a good sign.
  2. Ran redhat-config-printer (this is somewhere under the main desktop menu in Fedora, but I ran it from a shell for some reason). I added the printer as the right model (HP DeskJet 3600 series), and printed a test page - all good. I made sure the printer was shared while in the printing setup program.
  3. Added it to samba; man cupsaddsmb told me that I had to add this stuff to my smb.conf file:
    load printers = yes
    printing = cups
    printcap name = cups
    comment = All Printers
    path = /var/spool/samba
    browseable = no
    public = yes
    guest ok = yes
    writable = no
    printable = yes
    printer admin = (my-username)
    which I did, and restarted samba (service smb restart). Lo and behold, I could see the printer from my windows machines, but I still couldn't print to it (jobs would silently disappear).
  4. Enabled raw mode printing (this was the key step): In /etc/cups/mime.convs, I uncommented the line at the bottom that reads:
    application/octet-stream application/vnd.cups-raw 0 -
    In /etc/cups/mime.types, I uncommented the line at the bottom that reads:
    I restarted cups (service cups restart), and samba for good measure. I could now print to it from my windows boxes! If all you want to do is share via samba, you can stop reading here. Read on on for the IPP method.
  5. Added a raw queue for the printer, again through redhat-config-printer. To do this, I selected the "Generic" drop down in the "Printer model" step of the wizard, and selected "Raw Print Queue". Note: this printer queue will only be useful to those machines configured with a printer driver (Also remember to share the queue).
  6. On the windows machines, I added a new printer (Start -> Control Panel -> Printers and Faxes -> Add Printer). I chose to add a new network printer, selecting "Connect to a printer on the Internet", and using a URL of http://hostip:631/printers/RawPrinterQueueName. I selected the printer driver as I would have for a locally connected printer (I had downloaded the drivers from HP's website). Success!
  7. I basked in the warm glow of having foughtthe unholy alliance of Linux, Cups and Samba, and having won.
You might also need to make cups accept IPP connections from other machines if it doesn't already; if you can't connect to the printer via IPP, add an Allow line to your /etc/cups/cupsd.conf in the appropriate section, such as (for a LAN in the 192.168.0.* range):
<Location />
Order Deny,Allow
Deny From All
Allow From
Allow From 192.168.0.*

Many thanks to Colin Stewart's page at for the instructions.

Now, Some keywords, for google's benefit: linux, cups, samba, windows, windows XP, print, printer, printing, HP, Hewlett Packard, 3600, deskjet, raw, IPP. That ought to do it. If you got this far, congratulations :)

  1. I found that printing via IPP was faster to start and a bit more reliable. When printing via samba it used to choke occasionally, requiring me to reset the printer; via IPP, I haven't had that problem at all. YMMV, of course.


Blogger Saemon said...

I am going to assume you were writing in english there...maybe...
I only read down to the bit where it said " can stop reading here. No, really...."

8:52 am  
Blogger GUY M. WALSH, Bkr said...

Ben i just got Firefox and am having problems with my hotmail box. you seem to know a bit about this type of stuff and i ahve already gooten no replys to my posting on mozillazine so i am going to try you.
since i have started using firefox my eprsonal signature in my hotmail does not show up it only shows as html. when i open hotmaul in IE the signature shows up as it is supposed to. is there some type of setting wihtin the firefox browser that i cna change? if you don't know thanks for reading my question anyway. how ya hwo do i ge t a links section on my blog. thnaks man

9:19 am  
Blogger Ben said...


Comment posted on your blog, dude.

10:41 am  

Post a Comment

<< Home