[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 |
---|
| 18 | have been placed, together with their answers. |
---|
| 19 | You may notice that some questions have the same answer, |
---|
| 20 | but the symptoms appear differently. |
---|
| 21 | <P>Some of these answers will reference other material in this FAQ, |
---|
| 22 | or 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 |
---|
| 27 | who try to use LPRng with network printers or other systems |
---|
| 28 | supporting |
---|
| 29 | <A HREF="#rfc1179">RFC1179</A> printing. |
---|
| 30 | For 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 |
---|
| 34 | trying to send a print job from LPRng to other BSD LPR or RFC1179 |
---|
| 35 | LPR implementations, or with network connected printers |
---|
| 36 | that have a built in LPR server. |
---|
| 37 | This is due to the following RFC1179 rule: |
---|
| 38 | <BLOCKQUOTE> |
---|
| 39 | Servers 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 |
---|
| 42 | cannot open connections from them. This provides a small amount |
---|
| 43 | of security from UNIX users on the host 'spoofing' a server. |
---|
| 44 | <P>IMPLICATION: in order to do use a reserved port, the program |
---|
| 45 | must have root privileges. This means the LPR, LPD, LPQ, etc., |
---|
| 46 | programs must be installed SUID root. This can open up a can |
---|
| 47 | of worms with regard to security, but LPRng has been designed to |
---|
| 48 | take as much paranoid care as possible to avoid problems. |
---|
| 49 | <P>WHAT TO DO:<BR> |
---|
| 50 | When installing LPRng, you will need to install the executables |
---|
| 51 | SUID root. |
---|
| 52 | In the <CODE>src/Makefile</CODE>, you can remove the comment from the line |
---|
| 53 | <BLOCKQUOTE><CODE> |
---|
[12499] | 54 | <PRE> |
---|
[13097] | 55 | PERMS=SUID_ROOT_PERMS |
---|
[12499] | 56 | </PRE> |
---|
[13097] | 57 | </CODE></BLOCKQUOTE> |
---|
[12499] | 58 | |
---|
[13097] | 59 | and then do <CODE> make install</CODE>. |
---|
| 60 | This will install the executables |
---|
| 61 | SUID, 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 |
---|
| 66 | of jobs to a network printer or a remote system. |
---|
| 67 | The reason for this is a combination the above port 721-731 restriction |
---|
| 68 | and the TCP/IP timeouts. |
---|
| 69 | For details, see |
---|
| 70 | <A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>, |
---|
| 71 | but here is a quick explanation. |
---|
| 72 | <P>A TCP/IP connection is usually specified as between |
---|
| 73 | <CODE>srchost:srcport, desthost:destport</CODE>, |
---|
| 74 | although 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 |
---|
| 77 | exchanges the necessary flow control and error control information. |
---|
| 78 | When a connection is terminated, |
---|
| 79 | each end of the connection will not accept another connection from |
---|
| 80 | the same <CODE>host:port</CODE> that was previously active |
---|
| 81 | for a specified timeout period, |
---|
| 82 | usually 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) |
---|
| 86 | from a port that was active, |
---|
| 87 | or 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, |
---|
| 89 | which must originate a connection on port 721-731, connect |
---|
| 90 | to the server, which waits for a connection on port 515. |
---|
| 91 | We 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>. |
---|
| 94 | The first time that we make the connection (or the first connection) |
---|
| 95 | we succeed. |
---|
| 96 | We can transfer a file, etc., and then close the connection. |
---|
| 97 | When we try to reconnect from |
---|
| 98 | <CODE>1.1.1.1:721</CODE> to |
---|
| 99 | <CODE>1.1.1.2:515</CODE> |
---|
| 100 | we get an error such as |
---|
| 101 | "address already in use" |
---|
| 102 | or "connection refused". |
---|
| 103 | <P>Luckily, we can use port 722 to originate a connection, |
---|
| 104 | and we can connect from |
---|
| 105 | <CODE>1.1.1.1:722</CODE> to |
---|
| 106 | <CODE>1.1.1.2:515</CODE>. |
---|
| 107 | We continue on, until we come to port 731, |
---|
| 108 | and 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 |
---|
| 111 | port |
---|
| 112 | range 721-731, but only that the connection originates from a |
---|
| 113 | reserved port, |
---|
| 114 | i.e. - in the range 1-1023. |
---|
| 115 | You can extend the range of ports used by LPRng by changing the |
---|
| 116 | <BLOCKQUOTE><CODE> |
---|
[12499] | 117 | <PRE> |
---|
[13097] | 118 | originate_port=721 731 |
---|
[12499] | 119 | </PRE> |
---|
[13097] | 120 | </CODE></BLOCKQUOTE> |
---|
[12499] | 121 | |
---|
[13097] | 122 | value in the defaults (<CODE>LPRng/src/common/defaults.c</CODE>) file or in the <CODE>lpd.conf</CODE> |
---|
| 123 | file. I recommend the following: |
---|
| 124 | <BLOCKQUOTE><CODE> |
---|
[12499] | 125 | <PRE> |
---|
[13097] | 126 | originate_port=512 1022 |
---|
[12499] | 127 | </PRE> |
---|
[13097] | 128 | </CODE></BLOCKQUOTE> |
---|
[12499] | 129 | |
---|
[13097] | 130 | This is, in fact, now the default in LPRng software. |
---|
| 131 | If you get the infamous |
---|
| 132 | <CODE>malformed from address</CODE> |
---|
| 133 | error message from your spooler, then |
---|
| 134 | you will have to set originate_port=721 731, and live with |
---|
| 135 | a 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, |
---|
| 140 | the LPR program copied users files to a special spool queue directory, |
---|
| 141 | and then caused the LPD server to peek in the directory and print |
---|
| 142 | the files. |
---|
| 143 | <P>This type of operation required spool directory space, |
---|
| 144 | special SETUID programs, |
---|
| 145 | and 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 |
---|
| 147 | connections and transfer jobs directly to a LPD server running on |
---|
| 148 | a remote host, |
---|
| 149 | or even the local host if appropriate. |
---|
| 150 | Note that this type of operation does not require a LPD server to run |
---|
| 151 | on each local machine. |
---|
| 152 | In fact, you can have a single host system performing all of your |
---|
| 153 | printing. |
---|
| 154 | This type of operation is very similar to a central mail server versus |
---|
| 155 | individual systems, each having their own mail server and queues. |
---|
| 156 | <P>However, |
---|
| 157 | some users require or want their jobs to be spooled on the local host system, |
---|
| 158 | and then transferred to the remote printer. |
---|
| 159 | This is usually the case when some type of processing (filtering) |
---|
| 160 | is needed in order to print the job correctly. |
---|
| 161 | There 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> |
---|
| 164 | serviced by the LPD server on |
---|
| 165 | <CODE>host</CODE> |
---|
| 166 | by using the form: |
---|
| 167 | <BLOCKQUOTE><CODE> |
---|
[12499] | 168 | <PRE> |
---|
[13097] | 169 | lpr -Ppr@host file |
---|
[12499] | 170 | </PRE> |
---|
[13097] | 171 | </CODE></BLOCKQUOTE> |
---|
| 172 | <P>You can also set the <CODE>PRINTER</CODE> environment variable to |
---|
| 173 | a similar form, and get the same effect: |
---|
| 174 | <BLOCKQUOTE><CODE> |
---|
[12499] | 175 | <PRE> |
---|
[13097] | 176 | PRINTER=pr@host; export PRINTER; |
---|
| 177 | lpr 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, |
---|
| 182 | i.e. - you can use aliases or abbreviations for the names of printers, |
---|
| 183 | then here is a couple of hints. |
---|
| 184 | First, |
---|
| 185 | the LPRng software scans the <CODE>/etc/printcap</CODE> file for printcap |
---|
| 186 | entries, combining information for the same printer into a single entry. |
---|
| 187 | Information found later in the printcap file will override earlier |
---|
| 188 | information. |
---|
[12499] | 189 | In addition, |
---|
[13097] | 190 | you can tag entries as either being used for all utilities or just |
---|
| 191 | for the LPD server. |
---|
| 192 | Here are a couple of examples: |
---|
| 193 | <BLOCKQUOTE><CODE> |
---|
[12499] | 194 | <PRE> |
---|
[13097] | 195 | # for all utilities |
---|
| 196 | pr:lp=pr@host |
---|
| 197 | # just for LPD |
---|
| 198 | pr:server |
---|
| 199 | :lp=/dev/lp |
---|
| 200 | # more information |
---|
| 201 | pr:check_for_nonprintable@ |
---|
| 202 | # --- final result for LPR |
---|
| 203 | pr:lp=pr@host:check_for_nonprintable@ |
---|
| 204 | # --- final result for LPD |
---|
| 205 | pr:lp=/dev/lp:check_for_nonprintable@ |
---|
[12499] | 206 | </PRE> |
---|
[13097] | 207 | </CODE></BLOCKQUOTE> |
---|
| 208 | <P>As you can see, |
---|
| 209 | the <CODE>server</CODE> |
---|
[14516] | 210 | keyword indicates that the printcap entry is only for the server. |
---|
[13097] | 211 | The LPR utility will send the job to the host, while the LPD server |
---|
| 212 | will print it on <CODE>/dev/lp</CODE>. |
---|
| 213 | <P>Note that the <CODE>lp=...</CODE> information overrides the |
---|
| 214 | <CODE>:rp:</CODE> (remote printer) |
---|
| 215 | and |
---|
| 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> |
---|
| 220 | printcap or configuration flag forces non-LPD applications to send all |
---|
| 221 | requests and print jobs to the server running on the local host. |
---|
| 222 | <P>This method is similar to the previous one, |
---|
| 223 | but has the benefit that it can be configured as a global (i.e. - |
---|
| 224 | applies to all printers) rather than printer specific. |
---|
| 225 | You can put this in the <CODE>/etc/lpd.conf</CODE> file for general |
---|
| 226 | application, or have a printcap entry of the following form: |
---|
| 227 | <BLOCKQUOTE><CODE> |
---|
[12499] | 228 | <PRE> |
---|
[13097] | 229 | # for all utilities |
---|
| 230 | pr: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, |
---|
| 235 | and send jobs to the <CODE>pr</CODE> queue on the <CODE>host</CODE> |
---|
| 236 | machine. |
---|
| 237 | However, the LPR, LPQ, etc., utilities will send their requests to the |
---|
| 238 | server 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, |
---|
| 243 | and usually occurs when sending jobs to either a network printer or |
---|
| 244 | a nonconforming |
---|
| 245 | <A HREF="#rfc1179">RFC1179</A> |
---|
| 246 | print spooler. |
---|
| 247 | For details about LPRng and RFC1179, see |
---|
| 248 | <A HREF="LPRng-HOWTO-18.html#rfc1179ref">RFC1179 and LPRng</A>, |
---|
| 249 | but here is a quick explanation. |
---|
| 250 | <P>An LPD job consists of a control file, which contains information |
---|
| 251 | about the job, and one or more data files. RFC1179 is silent on the |
---|
| 252 | order that jobs are sent; however some implementations REQUIRE that |
---|
| 253 | the 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 |
---|
| 256 | printer, or in the <CODE>lpd.conf</CODE> configuration file. This is: |
---|
| 257 | <BLOCKQUOTE><CODE> |
---|
[12499] | 258 | <PRE> |
---|
[13097] | 259 | :send_data_first: (printcap) |
---|
| 260 | send_data_first (lpd.conf) |
---|
[12499] | 261 | </PRE> |
---|
[13097] | 262 | </CODE></BLOCKQUOTE> |
---|
| 263 | <P>Note that some printers/servers INSIST on the control file first; |
---|
| 264 | You 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. |
---|
| 269 | It is silent if other ones can appear as well. |
---|
| 270 | Unfortunately, some implementations will reject jobs unless they contain |
---|
| 271 | ONLY fields from a very small set. In addition, RFC1179 is silent |
---|
| 272 | about the ORDER the fields can appear. |
---|
| 273 | <P>LPRng quite happily will accept jobs from poor or nonconforming RFC1179 |
---|
| 274 | spooler programs, |
---|
[14516] | 275 | and fix them up to be conformant. |
---|
[13097] | 276 | <P>If you are sending jobs to one of a non-conforming spooler, |
---|
| 277 | you can force LPRng to send jobs with only the fields described |
---|
| 278 | in RFC1179 by setting the |
---|
| 279 | the <CODE> :bk: </CODE> (BacKwards compatible) flag in the |
---|
| 280 | printcap 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 |
---|
| 285 | using the TCP/IP protocol between hosts. |
---|
| 286 | The standard was developed by simply detailing the way that |
---|
| 287 | a version of the BSD LPD software did its job. |
---|
| 288 | <P>From the RFC Introduction: |
---|
| 289 | <BLOCKQUOTE> |
---|
| 290 | RFC 1179 describes a print server protocol widely used on |
---|
| 291 | the Internet for communicating between line printer daemons (both |
---|
| 292 | clients and servers). RFC1179 is for informational purposes only, |
---|
| 293 | and does not specify an Internet standard. |
---|
| 294 | </BLOCKQUOTE> |
---|
| 295 | <P>Having said this, |
---|
| 296 | the RFC then goes on to describe the protocol used |
---|
| 297 | by a particular implementation of LPD. |
---|
| 298 | The problem was that the RFC did not provide |
---|
| 299 | any way to put extensions to the operations into the system, |
---|
| 300 | and failed to specify such interesting details as the order in which |
---|
| 301 | print jobs and their components could be transferred. |
---|
| 302 | <P>Comment by Patrick Powell <CODE> <papowell@astart.com> </CODE>: |
---|
| 303 | <BLOCKQUOTE> |
---|
| 304 | <P>Since 1988, |
---|
| 305 | there have been a large number of print spooling systems developed which |
---|
| 306 | claim RFC1179 conformance, |
---|
| 307 | but which are mutually incompatible. |
---|
| 308 | <P>Rather than live with the limited capabilities of the RFC1179 standard, |
---|
| 309 | LPRng has extended them by adding capabilities to perform remote control |
---|
| 310 | of print spoolers, |
---|
| 311 | encrypted and authenticated data transfers, |
---|
| 312 | and other operations missing from the RFC1179 specification. |
---|
| 313 | However, |
---|
| 314 | great effort was made to be backwards compatible with older and other LPD |
---|
| 315 | based systems. |
---|
| 316 | <P>LPRng was developed in order to be able to both accept and provide |
---|
| 317 | interactions with these systems. It does so by allowing various options |
---|
| 318 | to be used to <EM>tune</EM> how print jobs would be exchanged. |
---|
| 319 | Currently, |
---|
| 320 | LPRng can be configured to send and receive print jobs between a vast number |
---|
| 321 | of the existing spooling systems. |
---|
| 322 | It is flexible enough to act as a gateway between non-compatible systems, |
---|
| 323 | and has provisions to transform jobs from one format to another in a dynamic |
---|
| 324 | manner. |
---|
| 325 | </BLOCKQUOTE> |
---|
| 326 | <P>For a detailed explanation |
---|
| 327 | about 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, |
---|
| 333 | it inherited its command names and options from the latter. As you |
---|
| 334 | might know, System V uses a totally different set of commands, |
---|
| 335 | incompatible with the BSD ones. |
---|
| 336 | <P>The good news is that the LPRng binaries include an emulation for the |
---|
| 337 | System V commands. |
---|
| 338 | (See |
---|
| 339 | <A HREF="LPRng-HOWTO-4.html#lpsimulation">lp Simulation</A> |
---|
| 340 | for details. |
---|
| 341 | Briefly, you create links to the appropriate programs, |
---|
| 342 | and 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] | 347 | ln -s lpr lp |
---|
| 348 | ln -s lpq lpstat |
---|
| 349 | ln -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 |
---|
| 354 | their 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 |
---|
| 356 | to work. In particular, I would guess that any script which relies on |
---|
| 357 | the output format of one of your system binaries will break. |
---|
| 358 | Again, see |
---|
| 359 | <A HREF="LPRng-HOWTO-4.html#lpsimulation">lp Simulation</A> |
---|
| 360 | for 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 |
---|
| 365 | the extra features it has, compared to vanilla BSD LPR. A short list |
---|
| 366 | is given in section |
---|
| 367 | <A HREF="LPRng-HOWTO-1.html#secfeatures">What is LPRng?</A>. (A |
---|
| 368 | more 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 V system will require some work. |
---|
| 372 | On the other hand, |
---|
| 373 | getting System V printing to work correctly for you may be even more work.</LI> |
---|
| 374 | <LI>You don't need any of the enhanced features, |
---|
| 375 | and are not worried about security issues. |
---|
| 376 | On the other hand, |
---|
| 377 | you may not have known about them.</LI> |
---|
| 378 | <LI>While there are many resources and books devoted to the old BSD |
---|
| 379 | printer daemon, documentation for LPRng is rather limited. |
---|
| 380 | On the other hand, you get lots of diagnostics and error messages when things |
---|
| 381 | go 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> |
---|