source: trunk/third/lprng/doc/LPRng-HOWTO-6.html @ 14517

Revision 14517, 15.2 KB checked in by mwhitson, 25 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r14516, which included commits to RCS files with non-trunk default branches.
RevLine 
[12499]1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2<HTML>
3<HEAD>
[13097]4 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
5 <TITLE> LPRng-HOWTO: The Most Frequently Asked Questions</TITLE>
6 <LINK HREF="LPRng-HOWTO-7.html" REL=next>
7 <LINK HREF="LPRng-HOWTO-5.html" REL=previous>
8 <LINK HREF="LPRng-HOWTO.html#toc6" REL=contents>
[12499]9</HEAD>
10<BODY>
11<A HREF="LPRng-HOWTO-7.html">Next</A>
12<A HREF="LPRng-HOWTO-5.html">Previous</A>
13<A HREF="LPRng-HOWTO.html#toc6">Contents</A>
14<HR>
[13097]15<H2><A NAME="FAQ"></A> <A NAME="s6">6. The Most Frequently Asked Questions</A></H2>
[12499]16
[13097]17<P>In this section, the Most Frequently Asked Questions
18have been placed, together with their answers.
19You may notice that some questions have the same answer,
20but the symptoms appear differently.
21<P>Some of these answers will reference other material in this FAQ,
22or the LPRng man pages.
23<H2><A NAME="ss6.1">6.1 Why do I get malformed from address errors?</A>
[12499]24</H2>
25
[13097]26<P>This is the number one question asked by most LPRng users
27who try to use LPRng with network printers or other systems
28supporting
29<A HREF="#rfc1179">RFC1179</A> printing.
30For details about LPRng and RFC1179, see
31<A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>.
[12499]32<P>The
[13097]33<CODE> malformed from address </CODE> error is usually reported when
34trying to send a print job from LPRng to other BSD LPR or RFC1179
35LPR implementations, or with network connected printers
36that have a built in LPR server.
37This is due to the following RFC1179 rule:
38<BLOCKQUOTE>
39Servers originate a connection from ports in the range 721-731.
40</BLOCKQUOTE>
41<P>WHY?  These are a subset of the 'reserved' ports in UNIX, and normal users
42cannot open connections from them.  This provides a small amount
43of security from UNIX users on the host 'spoofing' a server.
44<P>IMPLICATION:  in order to do use a reserved port,  the program
45must have root privileges.  This means the LPR, LPD, LPQ, etc.,
46programs must be installed SUID root.  This can open up a can
47of worms with regard to security,  but LPRng has been designed to
48take as much paranoid care as possible to avoid problems.
49<P>WHAT TO DO:<BR>
50When installing LPRng,  you will need to install the executables
51SUID root.
52In the <CODE>src/Makefile</CODE>,  you can remove the comment from the line
53<BLOCKQUOTE><CODE>
[12499]54<PRE>
[13097]55PERMS=SUID_ROOT_PERMS
[12499]56</PRE>
[13097]57</CODE></BLOCKQUOTE>
[12499]58
[13097]59and then do <CODE> make install</CODE>.
60This will install the executables
61SUID, and owned by root.
62<H2><A NAME="ss6.2">6.2 It was working normally, then I get connection refused errors</A>
63</H2>
[12499]64
[13097]65<P>This message usually appears when you have been sending a large number
66of jobs to a network printer or a remote system.
67The reason for this is a combination the above port 721-731 restriction
68and the TCP/IP timeouts.
69For details, see
70<A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>,
71but here is a quick explanation.
72<P>A TCP/IP connection is usually specified as between
73<CODE>srchost:srcport, desthost:destport</CODE>,
74although in practice the order of source (src) and destination
75(dest) is not important.
76<P>When a connection is established,  each end of the connection
77exchanges the necessary flow control and error control information.
78When a connection is terminated,
79each end of the connection will not accept another connection from
80the same <CODE>host:port</CODE> that was previously active
81for a specified timeout period,
82usually 10 minutes.
83<P>Some TCP/IP implementations go further:  they will not allow
84<B>ANY</B> connection to be <B>originated</B>
85(via the <CODE>bind()</CODE> system call or API)
86from a port that was active,
87or accepted on a port that was active for this timeout period.
88<P>Now let us see what happens when we have a client program,
89which must originate a connection on port 721-731, connect
90to the server, which waits for a connection on port 515.
91We first try to make a connection from host:port
92<CODE>1.1.1.1:721</CODE> to
93<CODE>1.1.1.2:515</CODE>.
94The first time that we make the connection (or the first connection)
95we succeed.
96We can transfer a file, etc., and then close the connection.
97When we try to reconnect from
98<CODE>1.1.1.1:721</CODE> to
99<CODE>1.1.1.2:515</CODE>
100we get an error such as
101"address already in use"
102or "connection refused".
103<P>Luckily,  we can use port 722 to originate a connection,
104and we can connect from
105<CODE>1.1.1.1:722</CODE> to
106<CODE>1.1.1.2:515</CODE>.
107We continue on, until we come to port 731,
108and then we need to wait for our timeouts.
109<P>SOLUTION:
110<P>It appears that most RFC1179 implementations do not check for the exact
111port
112range 721-731,  but only that the connection originates from a
113reserved port,
114i.e. - in the range 1-1023.
115You can extend the range of ports used by LPRng by changing the
116<BLOCKQUOTE><CODE>
[12499]117<PRE>
[13097]118originate_port=721 731
[12499]119</PRE>
[13097]120</CODE></BLOCKQUOTE>
[12499]121
[13097]122value in the defaults (<CODE>LPRng/src/common/defaults.c</CODE>) file or in the <CODE>lpd.conf</CODE>
123file.  I recommend the following:
124<BLOCKQUOTE><CODE>
[12499]125<PRE>
[13097]126originate_port=512 1022
[12499]127</PRE>
[13097]128</CODE></BLOCKQUOTE>
[12499]129
[13097]130This is, in fact, now the default in LPRng software.
131If you get the infamous
132<CODE>malformed from address</CODE>
133error message from your spooler, then
134you will have to set originate_port=721 731,  and live with
135a delayed throughput.
136<H2><A NAME="ss6.3">6.3 Job is not in print queue, but it gets printed!</A>
[12499]137</H2>
138
[13097]139<P>In the original BSD LPD implementation,
140the LPR program copied users files to a special spool queue directory,
141and then caused the LPD server to peek in the directory and print
142the files.
143<P>This type of operation required spool directory space,
144special SETUID programs,
145and a slew of headaches in system security and management.
146<P>The LPR, LPQ, and other user programs in the LPRng suite use TCP/IP
147connections and transfer jobs directly to a LPD server running on
148a remote host,
149or even the local host if appropriate.
150Note that this type of operation does not require a LPD server to run
151on each local machine.
152In fact,  you can have a single host system performing all of your
153printing.
154This type of operation is very similar to a central mail server versus
155individual systems, each having their own mail server and queues.
156<P>However,
157some users require or want their jobs to be spooled on the local host system,
158and then transferred to the remote printer.
159This is usually the case when some type of processing (filtering)
160is needed in order to print the job correctly.
161There are several methods that can be used to force this.
162<P>Method 1: Explicit Printer Address
163<P>You can force a job to be sent directly to the <CODE> pr </CODE>
164serviced by the LPD server on
165<CODE>host</CODE>
166by using the form:
167<BLOCKQUOTE><CODE>
[12499]168<PRE>
[13097]169lpr -Ppr@host file
[12499]170</PRE>
[13097]171</CODE></BLOCKQUOTE>
172<P>You can also set the <CODE>PRINTER</CODE> environment variable to
173a similar form, and get the same effect:
174<BLOCKQUOTE><CODE>
[12499]175<PRE>
[13097]176PRINTER=pr@host; export PRINTER;
177lpr file
[12499]178</PRE>
[13097]179</CODE></BLOCKQUOTE>
180<P>Method 2: User and Server Printcap Entries
181<P>If you want to have the benefits of a printcap file,
182i.e. - you can use aliases or abbreviations for the names of printers,
183then here is a couple of hints.
184First,
185the LPRng software scans the <CODE>/etc/printcap</CODE> file for printcap
186entries, combining information for the same printer into a single entry.
187Information found later in the printcap file will override earlier
188information.
[12499]189In addition,
[13097]190you can tag entries as either being used for all utilities or just
191for the LPD server.
192Here are a couple of examples:
193<BLOCKQUOTE><CODE>
[12499]194<PRE>
[13097]195# for all utilities
196pr:lp=pr@host
197# just for LPD
198pr:server
199  :lp=/dev/lp
200# more information
201pr:check_for_nonprintable@
202# --- final result for LPR
203pr:lp=pr@host:check_for_nonprintable@
204# --- final result for LPD
205pr:lp=/dev/lp:check_for_nonprintable@
[12499]206</PRE>
[13097]207</CODE></BLOCKQUOTE>
208<P>As you can see,
209the <CODE>server</CODE>
[14516]210keyword indicates that the printcap entry is only for the server.
[13097]211The LPR utility will send the job to the host, while the LPD server
212will print it on <CODE>/dev/lp</CODE>.
213<P>Note that the <CODE>lp=...</CODE> information overrides the
214<CODE>:rp:</CODE> (remote printer)
215and
216<CODE>:rm:</CODE> (remote machine) fields if they are present.
217<P>Method 3: Force sending to server on <CODE>localhost</CODE>
218<P>The
219<CODE>force_localhost</CODE>
220printcap or configuration flag forces non-LPD applications to send all
221requests and print jobs to the server running on the local host.
222<P>This method is similar to the previous one,
223but has the benefit that it can be configured as a global (i.e. -
224applies to all printers) rather than printer specific.
225You can put this in the <CODE>/etc/lpd.conf</CODE> file for general
226application,  or have a printcap entry of the following form:
227<BLOCKQUOTE><CODE>
[12499]228<PRE>
[13097]229# for all utilities
230pr:lp=pr@host:force_localhost
[12499]231</PRE>
[13097]232</CODE></BLOCKQUOTE>
233<P>The LPD server will ignore the
234<CODE>force_localhost</CODE> flag,
235and send jobs to the <CODE>pr</CODE> queue on the <CODE>host</CODE>
236machine.
237However, the LPR, LPQ, etc., utilities will send their requests to the
238server running on the local host.
239<H2><A NAME="ss6.4">6.4 Job disappears and is never printed, but lpr works</A>
240</H2>
[12499]241
[13097]242<P>This is a rather disconcerting problem,
243and usually occurs when sending jobs to either a network printer or
244a nonconforming
245<A HREF="#rfc1179">RFC1179</A>
246print spooler.
247For details about LPRng and RFC1179, see
248<A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>,
249but here is a quick explanation.
250<P>An LPD job consists of a control file,  which contains information
251about the job,  and one or more data files.  RFC1179 is silent on the
252order that jobs are sent;  however some implementations REQUIRE that
253the data files be sent first,  followed by the control file.
254<P>SOLUTION:
255<P>Set the <CODE>send_data_first</CODE> flag in the printcap for the particular
256printer,  or in the <CODE>lpd.conf</CODE> configuration file.  This is:
257<BLOCKQUOTE><CODE>
[12499]258<PRE>
[13097]259:send_data_first:  (printcap)
260send_data_first    (lpd.conf)
[12499]261</PRE>
[13097]262</CODE></BLOCKQUOTE>
263<P>Note that some printers/servers INSIST on the control file first;
264You can clear the flag using <CODE>send_job_first@</CODE> if you need to.
265<H2><A NAME="ss6.5">6.5 I get messages about bad control file format</A>
[12499]266</H2>
267
[13097]268<P>RFC1179 describes a set of fields that MAY appear in the control file.
269It is silent if other ones can appear as well.
270Unfortunately,  some implementations will reject jobs unless they contain
271ONLY fields from a very small set.  In addition,  RFC1179 is silent
272about the ORDER the fields can appear.
273<P>LPRng quite happily will accept jobs from poor or nonconforming RFC1179
274spooler programs,
[14516]275and fix them up to be conformant.
[13097]276<P>If you are sending jobs to one of a non-conforming spooler,
277you can force LPRng to send jobs with only the fields described
278in RFC1179 by setting the
279the <CODE> :bk: </CODE> (BacKwards compatible) flag in the
280printcap for your printer.
281<H2><A NAME="rfc1179"></A> <A NAME="ss6.6">6.6 What is RFC 1179, the Line Printer Daemon Protocol?</A>
[12499]282</H2>
283
[13097]284<P>RFC1179 defines a standard method by which print jobs can be transferred
285using the TCP/IP protocol between hosts.
286The standard was developed by simply detailing the way that
287a version of the BSD LPD software did its job.
288<P>From the RFC Introduction:
289<BLOCKQUOTE>
290RFC 1179 describes a print server protocol widely used on
291the Internet for communicating between line printer daemons (both
292clients and servers).  RFC1179 is for informational purposes only,
293and does not specify an Internet standard.
294</BLOCKQUOTE>
295<P>Having said this,
296the RFC then goes on to describe the protocol used
297by a particular implementation of LPD.
298The problem was that the RFC did not provide
299any way to put extensions to the operations into the system,
300and failed to specify such interesting details as the order in which
301print jobs and their components could be transferred.
302<P>Comment by Patrick Powell <CODE> &lt;papowell@astart.com> </CODE>:
303<BLOCKQUOTE>
304<P>Since 1988,
305there have been a large number of print spooling systems developed which
306claim RFC1179 conformance,
307but which are mutually incompatible.
308<P>Rather than live with the limited capabilities of the RFC1179 standard,
309LPRng has extended them by adding capabilities to perform remote control
310of print spoolers,
311encrypted and authenticated data transfers,
312and other operations missing from the RFC1179 specification.
313However,
314great effort was made to be backwards compatible with older and other LPD
315based systems.
316<P>LPRng was developed in order to be able to both accept and provide
317interactions with these systems.  It does so by allowing various options
318to be used to <EM>tune</EM> how print jobs would be exchanged.
319Currently,
320LPRng can be configured to send and receive print jobs between a vast number
321of the existing spooling systems.
322It is flexible enough to act as a gateway between non-compatible systems,
323and has provisions to transform jobs from one format to another in a dynamic
324manner.
325</BLOCKQUOTE>
326<P>For a detailed explanation
327about LPRng and RFC1179, see
328<A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>.
329<H2><A NAME="ss6.7">6.7 I want to replace lp, lpstat, etc, but my programs need them</A>
[12499]330</H2>
331
[13097]332<P>LPRng was designed as a replacement the BSD printing system. As such,
333it inherited its command names and options from the latter. As you
334might know, System&nbsp;V uses a totally different set of commands,
335incompatible with the BSD ones.
336<P>The good news is that the LPRng binaries include an emulation for the
337System&nbsp;V commands.
338(See
339<A HREF="LPRng-HOWTO-4.html#lpsimulation">lp Simulation</A>
340for details.
341Briefly, you create links to the appropriate programs,
342and invoke them by the link names.
343<EM>Actually, these links are installed by default in recent versions.</EM>
344<P>
345<BLOCKQUOTE><CODE>
[12499]346<PRE>
[13097]347ln -s lpr lp
348ln -s lpq lpstat
349ln -s lprm cancel
[12499]350</PRE>
[13097]351</CODE></BLOCKQUOTE>
352<P>If you make these links, calling <CODE>lp</CODE>, <CODE>lpstat</CODE> and
353<CODE>cancel</CODE> will give you a (partial) SVR4 emulation. They have
354their own man pages, which you should read if you need the emulation.
355<P>Since it is a <B>partial</B> emulation, you shouldn't expect everything
356to work. In particular, I would guess that any script which relies on
357the output format of one of your system binaries will break.
358Again, see
359<A HREF="LPRng-HOWTO-4.html#lpsimulation">lp Simulation</A>
360for more details or additional suggestions.
361<H2><A NAME="ss6.8">6.8 What are the drawbacks to LPRng?</A>
[12499]362</H2>
363
[13097]364<P>There are many reasons to run LPRng, and most of them are related to
365the extra features it has, compared to vanilla BSD LPR. A short list
366is given in section
367<A HREF="LPRng-HOWTO-1.html#secfeatures">What is LPRng?</A>. (A
368more elaborate description can be found in the LPRng package itself.)
369<P>On the other hand, there are also reasons <B>not</B> to switch to LPRng:
370<UL>
371<LI>Switching from a System&nbsp;V system will require some work.
372On the other hand,
373getting System&nbsp;V printing to work correctly for you may be even more work.</LI>
374<LI>You don't need any of the enhanced features,
375and are not worried about security issues.
376On the other hand,
377you may not have known about them.</LI>
378<LI>While there are many resources and books devoted to the old BSD
379printer daemon, documentation for LPRng is rather limited.
380On the other hand, you get lots of diagnostics and error messages when things
381go wrong.</LI>
382</UL>
383<HR>
[12499]384<A HREF="LPRng-HOWTO-7.html">Next</A>
385<A HREF="LPRng-HOWTO-5.html">Previous</A>
386<A HREF="LPRng-HOWTO.html#toc6">Contents</A>
387</BODY>
388</HTML>
Note: See TracBrowser for help on using the repository browser.