Bug 59618 - JetDirect failure
Summary: JetDirect failure
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: printconf   
(Show other bugs)
Version: 7.2
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2002-02-11 12:22 UTC by Russel Winder
Modified: 2007-04-18 16:40 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-10 15:38:39 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch for jetdirectprint to use shutdown() before close() (246 bytes, patch)
2002-11-27 10:11 UTC, Need Real Name
no flags Details | Diff
Patch to Copy messages from printer to stderr (1.08 KB, patch)
2003-01-08 16:50 UTC, Peter J. Holzer
no flags Details | Diff

Description Russel Winder 2002-02-11 12:22:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020205

Description of problem:
I am setting up a JetDirect (HP LaserJet 4000N) and initially chose the generic
postscript printer driver.  I have now installed the HP 4000 Postscript driver
but get the same behaviour.

Trying to print the test page causes the printer to react (i.e. flash the
communications light) but nothing happens.  If I try and print a graphic file I
get 40 EIO 2 Bad transmission.

Clearly I have failed to initialize something correctly but I cannot think what
since all of the print spooler cam out of the RH72 distribution.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Start printconf-gui
2.Select Test menu and JPEG item

Actual Results:  Get an 40 EIO 2 Bad transmission 

Expected Results:  Print page

Additional info:

Comment 1 Tim Waugh 2002-02-11 15:26:04 UTC
Have you applied the updates relevant to your system?

Comment 2 Russel Winder 2002-02-11 18:23:42 UTC
Not sure what you mean by updates here.  I use red-carpet daily to update
everything on the RedHat 7.2 and Gnome channels so all files should be
up-to-date to RedHat and Ximian releases.

If there is a package or such like that I should have, i.e. my configuration is
not totally correct, then there would be a problem but as everything works (in
some sense) I am assuming the closure over all packages is correct.

Comment 3 Tim Waugh 2002-02-11 18:27:55 UTC
I mean official Red Hat updates.  Well, let's start from here: what version of
the following packages do you have?:


Comment 4 Russel Winder 2002-02-11 18:41:27 UTC
Package version numbers as requested:

[root@elon root]# rpm -qa | egrep "(printconf|Omni|foomatic|ghostscript)"
[root@elon root]# 

Is it right to do this dialogue via bugzilla or should we be emailing direct?

Comment 5 Tim Waugh 2002-02-11 18:53:50 UTC
Email gets lots; Bugzilla persists.

Okay, you haven't got the latest printconf, printconf-gui or foomatic packages.
 Please update them via up2date or FTP, at your preference.  The advisory is

Let me know if that changes the situation.

Comment 6 Russel Winder 2002-02-11 19:24:18 UTC
Joined RHN, registered my machine (giving RH all the details of my installation
it seems!) and ran up2date.  Did not upgrade kernel (but probably should do) did
upgrade printconf* and foomatic:

[root@elon root]# rpm -qa | egrep "(printconf|Omni|foomatic|ghostscript)"
[root@elon root]# 

Am wondering why red-carpet did not say these were not already up to date, am
totally confused whether to use up2date,red-carpet or both.

Behaviour of printconf-gui is still the same:  a4 test page flashes comms lights
but does not print, JPEG flashes comms lights and gives 40 EIO 2 Transmission
error on HP LJ 4000 N.

So unfortunately, it does not appear to be a problem with versions of
printconf-* and foomatic.

Comment 7 Tim Waugh 2002-02-12 14:29:44 UTC
Well, it might still be a bug in one of those packages.

What configurations has this printer worked in before?

Comment 8 Russel Winder 2002-02-13 09:10:13 UTC
The printer works fine from Solaris and from Windows98.  NB This is an HP
LaserJet 4000N so has JetDirect -- the printer is connected to my Ethernet and
has it's own IP address.  Each hosts interacts directly with the printer.

Until last week, Linux (LPRng) quite happily printed LaTeX generated PostScript
with lpr and printed mail messages out of Evolution so I thought that the
printer worked fine -- except using Mozilla/Galeon.  This whole problem only
arose because Mozilla/Galeon (I use Galeon but this just uses Mozilla
components) will not print Web pages where Netscape will.  I first thought it
was a Mozilla Postscript driver problem but this is clearly not the case as by
printing to file in Galeon and then printing from Solaris, using its lpr, pages
printed fine -- using lpr to print the same file on Linux fails so the problem
is associated with the LPRng print spooler.  So it seemed that there is
something in the Mozilla generated Postscript that causes problems in the LPRng
print spooler which Netscape generated code of the same Web pages do not have.

I then investigated reconfiguring the LPRng spooler with printconf-gui and
discovered that its test pages appeared to have the same problem as Galeon. I
now realize that I changed the printer driver from the Generic Postscript one to
the HP LJ 4000 one to see if that changed anything.  Clearly it did, it stopped
all printing from Linux.  I had been fooled into thinking printconf-gui was
having problems when in fact it was an artefact of changing the printer driver.
 Sorry for this faulty error report. (But there is still a problem...)

I have just tried a few more extensive tests. It appears that using the HP LJ
4000 Postscript printer driver configured for JetDirect means that Postscript
files cause the 40 EIO 2 Transmission failure and text files just download and
do nothing on what is clearly an HP LJ 4000 Postscript printer :-(.  

I have just changed back (using printconf-gui) from the HP LJ 4000 Postscript
printer driver to the generic Postscript printer driver and LaTeX Postscript now
prints again.  Indeed printconf-gui test now print as well.

I just checked a Web page using Galeon and it still fails with 40 EIO 2
Transmission error even though other tools and lpr can print to the printer fine.

So there are two errors.  Why does the Generic Postscript printer driver work
and the HP LJ 4000 Postscript printer driver fail when the printer is an HP LJ
4000?  Also Mozilla/Galeon still fails to print Web pages through LPRng (pages
that can be shown to print fine through other spoolers.  I guess these are LPRng
problems and not printconf-gui problems -- except that possible printconf-gui is
not setting up the files correctly for LPRng prior to restarting the lpd server?

Not sure how to proceed with this.

(PS  Just to proove printconf-gui can successfully print JPEGs, I can report
that the image claims it is a "TesImage" not a "Test Image" :-)

Comment 9 Tim Waugh 2002-02-15 09:14:04 UTC
I think they are both foomatic problems.  The difference between 'Postscript
Printer' and 'HP Laserjet 4000/Postscript' is that the latter is run through
'lpdomatic' with a parameter like 'Postscript-100576.foo' (which will be the
name of a file in the spool directory), whereas the former is sent through
lpdomatic with no such parameter given.

This file specifies the ways in which the Postscript should be mangled: for
example, to change paper tray, to select page size, set resolution etc.

Try changing the options of the HP Laserjet 4000/Postscript driver and see if
there is one particular option that is causing trouble.

(I'll concentrate on this problem first, and ignore the 'Transmission error' one
for now; perhaps they are the same thing.)

Comment 10 Neal Pape 2002-05-29 21:40:07 UTC
I am having a similar problem on Red Hat Linux 7.3.
I used printconf-gui to configure two queues for a LaserJet 8100 with a Jet
Direct card - the first queue configured for Jet Direct, and the second queue
configured for remote lpd.  When I try to print a postscript file saved from
Mozilla through the Jet Direct queue, part of the file prints, then I receive a
'40 EIO 1 Bad Transmission' error on the printer display.  When I print the file
using the second  queue, it prints successfully.

Comment 11 Rubin Isam Rivera Rodrmguez 2002-10-04 05:42:36 UTC
I hava a similar problem. 
My printer is an inkjet Lexmark 1100.
It is detected by the printconf. In the /dev/lp0
And everything seems to be ok. But when i try to print a test page, there is no
The job appear in the queue, and apparently works fine, but the printer doesn't
do anything.

The driver is there. Works with foomatic.

What could be the problem?

Thanks in advance.

Comment 12 Tim Waugh 2002-10-04 10:57:36 UTC
rubenisai@yahoo.com: This bug report is about the JetDirect transport 
mechanism I think.  Since you mention /dev/lp0 I'm assuming that yours is a 
locally-connected printer, and so I think it's a different issue.  Could you 
please open a separate bug report for that, and add a bit more detail?  

Comment 13 Russel Winder 2002-10-05 08:27:03 UTC
When I moved from RedHat 7.2 to RedHat 7.3 on my machines recently, I moved from
LPRng to CUPS as my printer spooling system.  I have not yet had the "40 EIO 2
Bad transmission" at all from Mozilla now that I am using CUPS.  It seems
therefore that the evidence indicates that it is a Mozilla / LPRng interaction
problem.  I have now removed LPRng from my systems.  Sorry if this sounds a
little defeatist but I needed a solution to the problem of printing pages in
Galeon and now have it (I hope !)

Comment 14 Tim Waugh 2002-10-05 08:35:39 UTC
I've been informed of the possible root cause of the JetDirect problem, and 
your experience appears to back that up. 
It appears that Mozilla uses "Helvetica_Oblique" instead of the correct name, 
"Helvetica-Oblique" (dash not underscore).  This leads to the printer sending 
back an error message during transfer of the job.  However, the jetdirectprint 
script is not prepared for this, and so the transfer fails. 
Knowing that CUPS handles this correctly is a useful datapoint.

Comment 15 Russel Winder 2002-10-05 09:37:56 UTC
Hey, quick response, thats cool!

I did a quick 'find -type f | strings | grep elv' on all the files in the
/usr/lib/mozilla-1.0.1 but didn't find anything untoward.  I guess the string
may be constructed in some way.

I am surprised that the Mozilla QA people would let something like this through,
the valid PostScript names are very well defined.  It suprises me more, of
course, that the CUPS people would deal with such an unique error.  Perhaps the
problem is in the component that turns HTML into PostScript, is this done in
Mozilla or in a Gnome component?

Comment 16 Tim Waugh 2002-10-05 10:38:44 UTC
The incorrect font name would be harmless if the jetdirectprint script only 
handled data in the reverse direction.  It doesn't, and so the job goes awry. 
(CUPS has its own handler for jetdirect transport, and that handles this 
correctly it seems.)

Comment 17 Need Real Name 2002-11-27 10:10:06 UTC
I ran into a print job that failed every single time and I was able to dig
deep to find the cause.  I think I've nailed it.

- The HP Jetdirect printer sometimes sends back status or error information
  to the host via the TCP connection.  For example when mozilla specifies the
  wrong font name the printer sends back "Helvetica_Oblique not found, using
  Courier."  But jetdirectprint doesn't read anything from the TCP connection,
  it just writes all the print data then closes the connection.
- In the kernel (tcp_close() in tcp.c), when a TCP connection is closed and
  there's unread receive data, Linux sends a TCP RST to indicate that the
  receive data was lost, instead of sending the TCP FIN it would normally send
  to indicate that Linux wants to gracefully shut down the connection.  That's
  the right thing to do according to the various RFCs.
- If all the print data happened to get safely to the printer before the RST
  then the job prints okay; if not then there's an error.  So the problem can
  be intermittent or job dependent.

The fix is in jetdirectprint to use shutdown() to gracefully close the sending
side of the connection while keeping the receiving side open for status data,
then read any status data the printer sends until the printer closes the
receive side, then do the close().

Here's a patch for jetdirectprint in printconf-0.3.77-1.  The status data is
just printed to jetdirectprint's STDOUT; hopefully that will go into a log
somewhere.  With this patch, a job that failed for me every time now prints
successfully every time.

--- jetdirectprint.orig	Mon Apr 15 16:15:15 2002
+++ jetdirectprint	Wed Nov 27 02:08:40 2002
@@ -60,8 +60,12 @@
   print $socket $_;
+shutdown($socket, SHUT_WR);
+while (<$socket>) {
+  print $_;

Comment 18 Need Real Name 2002-11-27 10:11:42 UTC
Created attachment 86666 [details]
Patch for jetdirectprint to use shutdown() before close()

Comment 19 Peter J. Holzer 2003-01-08 16:48:53 UTC
STDOUT of the filter script is sent to /dev/null, but STDERR is sent (indirectly)
to /var/spool/lpd/$printer/status.pr, so printing to STDERR would be better.

The attached patch (wrote this before I discovered this bug) does this and uses
select to read messages from the printer as soon as they are sent instead of at
the end of the session (probably doesn't make a difference).

BTW, can we increase the severity to high? I've got reports from users that
Mozilla is not the only program which causes problems.

Comment 20 Peter J. Holzer 2003-01-08 16:50:35 UTC
Created attachment 89214 [details]
Patch to Copy messages from printer to stderr

Comment 21 Tim Waugh 2004-12-10 15:38:39 UTC
We no longer use jetdirectprint, and the CUPS socket backend handles this
correctly I think.

Note You need to log in before you can comment on or make changes to this bug.