Bug 5835

Summary: Remote printing problem with lpd
Product: [Retired] Red Hat Linux Reporter: marinell
Component: lprAssignee: Bill Nottingham <notting>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: brown9, eloranta, rvokal, steveh
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-10-20 19:46:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description marinell 1999-10-11 15:08:59 UTC
I have a central print server for the UNIX systems that I
manage in my department. It collects print jobs from client
systems and sends them off to the apropriate printers.

Printing for clients upgraded to RedHat 6.1 fails to work.
The lpd daemon in RedHat 6.1 does not seem to transfer the
job to the remote print server. (I.E. logging on the print
server's lpd does not show any activity from a RedHat 6.1
print job)

Loading an older lpd binary from an another RedHat Linux
distribution (6.0 or 5.2) corrects the printing problem.

Comment 1 Bill Nottingham 1999-10-11 15:20:59 UTC
Can you try the lpr RPMs at

http://people.redhat.com/notting/lpr/
-or-
ftp://people.redhat.com/notting/lpr/

and let me know if they work for you?

Comment 2 Bill Nottingham 1999-10-11 15:35:59 UTC
OK, silly question; lpr was restarted after install, correct?

Are there stale print files hanging around in the queue on the
clients?

What does the /etc/printcap on the clients look like?

What sort of print server is the main server?

Comment 3 ptak 1999-10-14 17:03:59 UTC
I had the same problem, upgrading with the RPM listed below worked.

Comment 4 Bill Nottingham 1999-10-14 21:11:59 UTC
*** Bug 5697 has been marked as a duplicate of this bug. ***

with lpr-0.41-2 package distributed with rh6.1 the
network printing does not work. The jobs go to the
queue on the server but never come out (most likely
due to corrupt control files originating from the
client - see below).

It appears that the problem is in lpd/printjob.c
in function sendit(). The bug is somehow related to the
creation of the control file copy. If I remove the
control file copy code (which is forced in the current
version) then the printing begins to work.

------- Additional Comments From notting  10/07/99 17:33 -------
Could you try the lpr package from Raw Hide
(ftp://ftp.redhat.com/pub/rawhide/) and let us know if that
works better for you?  Remote printing works OK here...

------- Additional Comments From   10/08/99 03:54 -------
I had the same problem printing from a 6.1 box to a 6.0 box. after
downgrading lpr to the package in 6.0, everything works. I use
hosts.equiv authorization on the server.

------- Additional Comments From eloranta  10/08/99 03:58 -------
Using lpr-0.41-3 from rawhide solves the problem here.


------- Additional Comments From stoty  10/08/99 04:07 -------
I confirm, lpr-0.41-3 solves this problem for me, too.

------- Additional Comments From steveh.edu  10/08/99 04:15 -------
lpr-0.41-3 only partially fixes the problem. The current solution
will not work for multiple copies.

------- Additional Comments From steveh.edu  10/08/99 04:19 -------
Here is what I think is a more elegant solution to the problem. I'm
not sure I can paste a patch on this little box on the bugtraq web
page, but here goes... (I'm also submitting a similar patch to Debian
lpr, which is also based off of Redhat's 0.41 lpr; I'm actually a
Debian user <grin>). If this doesn't paste well and you're interested
in it, email me privately and I'll resend it.

--- ../lpr-0.41/lpd/printjob.c  Wed Sep 29 13:05:11 1999
+++ lpd/printjob.c      Fri Oct  8 03:45:14 1999
@@ -756,7 +756,6 @@ sendit(file)
        int  ifchild, pid;
        int  sendresult;
        int  tmpmask;
-       int  numcopies=0;

        int  ii;

@@ -875,16 +874,22 @@ sendit(file)

                        strcpy(last, line);
                        /* handle multiple copies */
-                       while (i = getline(cfp))
+                       while (i = getline(cfp)) {
+                         if (dup_cfp)
+                           fprintf(dup_cfp, "%s\n", line);
                                if (strcmp(last, line))
                                        break;
-                               else
-                                       numcopies++;
+                       }


                        /* msf - here is where we hack in IF
support    */
                        /*       will only run the IF, no other
filters */
                        /*       will be
run.                           */
+                       /* This hack will work for multiple files
only  */
+                       /* if the 'f' lines are separated by at
least   */
+                       /* one non-'f' line (i.e. a U or N line) due
to */
+                       /* the multiple copies getline() while
loop     */
+                       /* right above this
comment.                    */
                        if (IF != NULL && last[0] == 'f') {

                            memcpy(tmpfile, last+1, 7);
@@ -895,11 +900,6 @@ sendit(file)
                            /* Nasty trick of the day, to attempt
                             * to be RFC compliant */
                            rename(last+1,tmpfile);
-                           /* we make a new f and U entry for remote
cfp */
-
-                           for (;numcopies>0;numcopies--)
-                                 fprintf(dup_cfp, "f%s\n",last+1);
-                           fprintf(dup_cfp, "U%s\n",last+1);

                            fi = open(tmpfile, O_RDONLY);
                            ifi = open
(last+1,O_WRONLY|O_CREAT|O_TRUNC, 0664);
@@ -918,11 +918,6 @@ sendit(file)
                          /* wait on it to finish */
                          waitpid(ifchild, NULL, 0);
                         }
-                        else
-                        {
-                         if (dup_cfp)
-                           fprintf(dup_cfp, "%s\n", line);
-                         }

                         sendresult = sendfile('\3', last+1);




------- Additional Comments From notting  10/08/99 13:37 -------
OK, could you try the lpr-0.42-1 RPMs at
ftp://people.redhat.com/notting/lpr/
-or-
http://people.redhat.com/notting/lpr/

to make sure it still works for everyoone?  It checks out fine here...

------- Additional Comments From eloranta  10/09/99 11:23 -------
lpr-0.42-1 works ok here.


------- Additional Comments From   10/14/99 06:45 -------
I had the same problem. lpr-0.42-1 seems to fix it.

Comment 5 Bill Nottingham 1999-10-18 03:21:59 UTC
This should be fixed in the lpr-0.43-2 errata release.

Comment 6 Lance A. Brown 1999-10-19 17:35:59 UTC
I'm also experiencing problems printing from an RH 6.0 -> 6.1 upgraded
system to a centralized Windows NT print server providing lpd
services.

Upgraded to lpr-0.43-2 with no success.  Downgraded to lpr RPM shipped
on RH 6.0 CD with no success either.  Installed 0.43-2 again, removed
all entries from /etc/printcap and deleted all files and dirs in
/var/spool/lpd.  Used printtool to create new queue for remote printer
that worked before upgrade.  Print jobs still refuse to move from
local system to remote system.

lpq returns:

brown9@splat:~ $ lpq

splat.niehs.nih.gov: Warning: no daemon present
Rank   Owner      Job  Files                                 Total
Size
1st    root       0     ...                                  16408
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------


and

/var/log/messages receives:

Oct 19 13:27:53 splat lpd[29888]: restarting lp
Oct 19 13:27:53 splat lpd[29888]: lp: status: Permission denied

when I use lpc to restart the queues.

Comment 7 Bill Nottingham 1999-10-19 18:19:59 UTC
What's the permissions on the spool directory?

Comment 8 Lance A. Brown 1999-10-19 20:06:59 UTC
Permissions and ownership are as follows:

/var/spool/lpd:
drwxrwxr-x   3 root     daemon       1024 Oct 19 13:27 lpd/

/var/spool/lpd/*
drwxr-xr-x   2 root     lp           1024 Oct 19 13:27 lp/
-rw-r--r--   1 root     root            6 Oct 19 13:27 lpd.lock

Comment 9 Bill Nottingham 1999-10-19 20:28:59 UTC
Are there any lpd processes running at all?  What happens
if you do /etc/rc.d/init.d/lpd restart, as opposed to restarting
with lpc?

------- Additional Comments From   10/19/99 18:07 -------
here are the cf spool files on a remote system
that the redhat system is spooling to. 35 works
41 and 43 do not. notice the missing H from the
non-working control files. according to rfc1179
this is a required field.

hummmm...

35
--------
Hbaur
Pecb
Jprintcap
Cbaur
Lecb

K1
O -oBSDJprintcap -oBSDCbaur
FdfA025baur
fdfA025baur
UdfA025baur
N/etc/printcap



41
------
Proot
Jprintcap
UdfA006
N/etc/printcap

43-1
-----
Proot
Jtestpage.asc
B
K1
O -oBSDJtestpage.asc
FdfA005
fdfA005
UdfA005
N/usr/lib/rhs/rhs-printfilters//testpage.asc

Comment 10 Bill Nottingham 1999-10-19 22:13:59 UTC
Grr. Arrg. Typo.

Fixed in lpr-0.43-3.

Comment 11 Lance A. Brown 1999-10-20 11:43:59 UTC
Running /etc/rc.d/init.d/lpd restart gets the same error 'lpc restart
all':

from /var/log/messages:

Oct 20 07:40:25 splat lpd: lpd shutdown succeeded
Oct 20 07:40:26 splat lpd: lpd startup succeeded
Oct 20 07:40:29 splat lpd[15972]: restarting lp
Oct 20 07:40:29 splat lpd[15972]: lp: status: Permission denied

Immediately after the restart lpq shows:

brown9@splat:/var/spool/lpd $ lpq
splat.niehs.nih.gov: sending to print.niehs.nih.gov
Rank   Owner      Job  Files                                 Total
Size
1st    brown9     1    foo                                   1201
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------

and then it shows:

brown9@splat:/var/spool/lpd $ lpq

splat.niehs.nih.gov: Warning: no daemon present
Rank   Owner      Job  Files                                 Total
Size
1st    brown9     1    foo                                   1201
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------

Comment 12 Lance A. Brown 1999-10-20 11:59:59 UTC
Please disregard my last update.  I just installed lpr-0.44-1 from
updates.redhat.com and am now getting the following when I
'/etc/rc.d/init.d/lpd restart'

/var/log/messages gets:
Oct 20 07:57:36 splat lpd: lpd shutdown succeeded
Oct 20 07:57:36 splat lpd: lpd startup succeeded

and lpq now reports:

brown9@splat:~ $ lpq
splat.niehs.nih.gov: Warning: lp is down: sending to
print.niehs.nih.gov

splat.niehs.nih.gov: Warning: no daemon present
Rank   Owner      Job  Files                                 Total
Size
1st    brown9     1    foo                                   1201
bytes
2nd    brown9     2    netscape.ps                           27479
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------

The cf* files now have a proper 'H' line.

Comment 13 Lance A. Brown 1999-10-20 16:58:59 UTC
Running /etc/rc.d/init.d/lpd restart gets the same error 'lpc restart
all':

from /var/log/messages:

Oct 20 07:40:25 splat lpd: lpd shutdown succeeded
Oct 20 07:40:26 splat lpd: lpd startup succeeded
Oct 20 07:40:29 splat lpd[15972]: restarting lp
Oct 20 07:40:29 splat lpd[15972]: lp: status: Permission denied

Immediately after the restart lpq shows:

brown9@splat:/var/spool/lpd $ lpq
splat.niehs.nih.gov: sending to print.niehs.nih.gov
Rank   Owner      Job  Files                                 Total
Size
1st    brown9     1    foo                                   1201
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------

and then it shows:

brown9@splat:/var/spool/lpd $ lpq

splat.niehs.nih.gov: Warning: no daemon present
Rank   Owner      Job  Files                                 Total
Size
1st    brown9     1    foo                                   1201
bytes


                         Windows NT LPD Server
                              Printer \\157.98.XX.YY\bigelow

Owner       Status         Jobname          Job-Id    Size   Pages
Priority
----------------------------------------------------------------------------

Comment 14 Bill Nottingham 1999-10-20 17:03:59 UTC
Hmm... could you strace -f the running lpd process and see what
happens when it tries to restart to send the data?

Comment 15 Lance A. Brown 1999-10-20 17:58:59 UTC
Sent email to notting containing output of 'strace -f
-pLPDPID'.