2007-04-16 hypertwins printing problem

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

Introduction

Soon after a recent upgrade of Fedora Core from version 4 to version 6, Bunsen suddenly stopped being able to print to the Brother laser printer attached to it via USB cable.

Although it seemed unlikely, I had to rule out the possibility that there was actually something wrong with the printer (or cable), and therefore connected it to Gonzo (running Ubuntu 6.10) for testing. It worked fine there. However, I was still unable to get Bunsen to print to it while physically attached... but it seemed to have no problem printing to the Brother attached to Gonzo.

However, none of the other machines from which we regularly need to print (all of which are running Windows 98) could print to Gonzo. They would happly admit that they could see the Brother printer attached to Gonzo and allow it to be added to their "Printers" folder, but upon trying to print a test page we get a dialog saying that "the network name could not be found".

However again, just to make life interesting and provide a temporary workaround, we found that we could print to the not-really-there Brother printer on Bunsen, and then once the job appeared in the queue (in the CUPS control panel applet) tell Bunsen to redirect it to the Brother on Gonzo. This was awkward, but at least allowed us to continue using the laser printer while we tried to figure out what was going on.

Unfortunately, a week or more went by with no solution, and I tried tweaking some settings on Bunsen and suddenly Bunsen could no longer print to the Brother on Gonzo. Un-tweaking the settings has not made things start working. So now only Gonzo can print to the Brother, which means that no Windows programs can print to the laser printer at all (which is a problem for our postage-printing software, as barcodes don't do so well in smearable inkjet).

Some clues

The "network name could not be found" message appears to be the plain-english version of WIN32 error code 0xC00000CC, represented in code by the constant STATUS_BAD_NETWORK_NAME. (An example of how to deliberately cause this error is here.) It also appears to be poorly worded; what it means is that the machine in question (in this case Gonzo) could not find the requested share (in this case "\\GONZO\BROTHER"). Which is very weird, because if you run smbtree it will happily show that the Brother is being shared as such:

       \\GONZO                         Samba 3.0.22
               \\GONZO\brother         BROTHER HL-1250
               \\GONZO\Epson           EPSON Stylus Photo R320
               \\GONZO\HP890C          HP DeskJet 890C
               \\GONZO\ADMIN$          IPC Service (Samba 3.0.22)
               \\GONZO\IPC$            IPC Service (Samba 3.0.22)
               \\GONZO\SCRATCH         and sniff
               \\GONZO\STUFF           and things
               \\GONZO\Public
               \\GONZO\Files           File system, read-only
               \\GONZO\homes           Home Directories

(The other 2 printers listed here – the Epson and the HP – are shared from other machines, both running Win98. Gonzo has no problem printing to them, nor does anyone else.)

So I broke out the big guns and used Wireshark to take a look at the network traffic between a sample machine (in this case Scooter, a laptop also running Ubuntu 6.10) and Gonzo, and found that Gonzo was going all Apostle Peter on me and denying its Brother:

pkt # from to what
999 192.168.0.100 (Scooter) 192.168.0.254 (Gonzo) Tree Connect AndX Request, Path: \\GONZO\BROTHER
1000 192.168.0.254 (Gonzo) 192.168.0.100 (Scooter) Tree Connect AndX Response, Error: STATUS_BAD_NETWORK_NAME

Not expecting it to help, I tried renaming the printer to uppercase ("BROTHER" instead of "Brother") on both Scooter and Gonzo, in case some kind of annoying case-sensitivity was at work, but no luck there. (Note: after renaming a printer in CUPS, you have to restart either CUPS or Samba or perhaps both in order to get the new name to show up in the list of shares.)

So I'm back to being mystified, and am going to read more about Samba, as I'm pretty sure the problem is not with CUPS.

Another thing I need to try is having Bunsen talk to Gonzo's Brother via CUPS instead of via Samba; this may revive our temporary workaround, and perhaps I can figure out why Bunsen is accepting printer jobs when Gonzo isn't. --Woozle 22:02, 16 April 2007 (EDT)

2007-04-17 Solved

(Although I was able to get Scooter to talk to Gonzo's Brother via CUPS, it wouldn't redirect jobs there for some reason... printers attached to other machines seem to appear unpredictably in the list of printers when certain settings change, and I don't really understand what's going on.)

I checked Gonzo's samba logs, specifically the log for communication with Scooter, and got this after trying to print a test page on Brother@Gonzo from Scooter:

root@gonzo:/home/woozle# tail -f /var/log/samba/192.168.0.100.log
[2007/04/17 17:34:37, 0] printing/printing.c:print_job_start(2383)
  print_job_start: insufficient permissions to open spool file /var/spool/samba/smbprn.00000003.vazB0I.
[2007/04/17 17:34:37, 1] smbd/service.c:close_cnum(890)
  192.168.0.100 (192.168.0.100) closed connection to service BROTHER
[2007/04/17 17:35:48, 1] smbd/service.c:make_connection_snum(693)
  192.168.0.100 (192.168.0.100) connect to service BROTHER initially as user sambaguest (uid=1001, gid=500) (pid 20410)
[2007/04/17 17:35:48, 0] printing/printing.c:print_job_start(2383)
  print_job_start: insufficient permissions to open spool file /var/spool/samba/smbprn.00000004.9yVDtF.
[2007/04/17 17:35:48, 1] smbd/service.c:close_cnum(890)
  192.168.0.100 (192.168.0.100) closed connection to service BROTHER

So then I changed permissions on /var/spool/samba so anyone could create files in it, tried the test page again, and got this:

[2007/04/17 17:48:15, 1] smbd/service.c:make_connection_snum(693)
  192.168.0.100 (192.168.0.100) connect to service BROTHER initially as user sambaguest (uid=1001, gid=500) (pid 24697)
sh: lpr: not found
[2007/04/17 17:48:21, 1] smbd/service.c:close_cnum(890)
  192.168.0.100 (192.168.0.100) closed connection to service BROTHER

A little Googling for "sh: lpr: not found" led to some rather old message logs (2002 and 1998) which seemed to indicate that lpr might be related to lp, which is the command-line command for sending raw data to a printer. A little further investigation revealed that in Ubuntu, there are two different packages providing command-line tools for CUPS. One provides BSD-standard commands, and the other provides Unix System V commands:

  • cupsys-bsd: Common UNIX Printing System(tm) - BSD commands
    • This package provides the BSD commands for interacting with CUPS. It is provided separately to allow CUPS to coexist with other printing systems (to a small degree).
  • cupsys-client: Common UNIX Printing System(tm) - client programs (SysV)
    • This package provides the System V style print client programs.

I had apparently installed cupsys-client, which contains lp, but not cupsys-bsd, which contains lpr and lpv, and apparently Samba tries to use lpr for printing.

After installing cupsys-bsd, Brother@Gonzo magically started printing stuff sent to it by other machines, including Windows machines. Problem apparently solved.