Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2002 10:10:30 +0100
From:      Andreas Klemm <andreas@apsfilter.org>
To:        apsfilter-help@apsfilter.org
Cc:        Garance A Drosihn <drosih@rpi.edu>, desmo@bandwidth.org, freebsd-stable@freebsd.org
Subject:   4.4R: if: doesn't get started when getting remote print job (Re: apsfilter doesn't work on server)
Message-ID:  <20020116091030.GA16535@titan.klemm.gtn.com>
In-Reply-To: <20020115213522.GA15920@christian.chrullrich.de>
References:  <20020115062456.GA13349@christian.chrullrich.de> <XFMail.020115124543.phallobst@web.de> <20020115151846.GA14953@christian.chrullrich.de> <20020115213522.GA15920@christian.chrullrich.de>

next in thread | previous in thread | raw e-mail | index | archive | help

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Jan 15, 2002 at 10:35:22PM +0100, Christian Ullrich wrote:
> * Christian Ullrich wrote on Tuesday, 2002-01-15:
>=20
> > * Michael Lo=DFin wrote on Tuesday, 2002-01-15:
> >=20
> > > On 15-Jan-02 Christian Ullrich wrote:
> >=20
> > > Which spooler do you use on those?
> >=20
> > BSD lpd on the Server, LPRng on the client.
> >=20
> > > Please try to use LPRng on server *and* client machines, since
> > > the old BSD-style lpd has some problems with remote printing.
> >=20
> > I'll try that ASAP.
>=20
> Warning: The following is _very_ detailed. It took me three hours
> to do it all and write it down. If there is _any_ information=20
> missing, please do not hesitate to ask.
>=20
> Just as a reminder: The server is FreeBSD 4.4-RELEASE, the client
> is SuSE Linux 7.3, using LPRng 3.7.4. The printer in question,=20
> connected to the server by parallel cable, is an HP LaserJet 1200,
> which is PostScript Level2 capable, although it also supports PCL.
> The problem in question is that, while printing on the server=20
> works just fine, printing from the client seems to bypass apsfilter.
> The symptoms are:
> - Text is printed with "staircase effect".
> - PostScript is printed flawlessly.
> - Anything else is not printed at all.
>=20
> The following is an account of my adventures tonight. Steps 1 to
> 18 took place on the server, 19, 20 and 21 on the client.
>=20
> 1. I updated selected parts of the installed ports, nothing to do
>    with printing or graphics or such things (but I thought I should
>    include it here).
>=20
> 2. I moved /etc/printcap and /etc/apsfilter out of the way.
>=20
> 3. I moved all files in /usr/bin and /usr/sbin with names starting=20
>    with "lp" out of the way, provided they looked like parts of
>    BSD lpd: /usr/bin/{lp,lpq,lpr,lprm} and /usr/sbin/{lpc,lpd}
>=20
> 4. I rebuilt LPRng-3.7.6 from the ports collection and installed it
>    as it was built, without messing with the build directory.
>=20
> 5. I verified the settings in /usr/local/etc/rc.d/lprng.sh and found
>    them to be in good order.
>=20
> 6. I built apsfilter-7.2.1, with the following options enabled:
>    - A4 - A4 papersize
>    - GS_NO_X11 - Postscript for non-PS printer, no X11
>    - GS_PDF_CRYPT - print encrypted PDF files using gs
>    - PSUTILS - for pseudo duplex printing + paper handling
>    - A2PS - ASCII files in different styles/orientation
>    - DVIPS - TeX DVI files
>    - HTML2PS - HTML documents
>    - TROFF - Troff documents
>    - BZIP2 - print bunzip2 compressed documents
>    On the first attempt to "make install" apsfilter, I was told that
>    the file /usr/local/etc/apsfilter existed. It was a symbolic link
>    to /etc/apsfilter, which I had renamed in step 2. I removed the=20
>    link and installed again. This time it worked fine.

If you had updated the ports collection you would have used
apsfilter 7.2.1, which includes a fix for that by using
ln -sf ...

> 7. I started the SETUP script and accepted the ownership of
>    root.daemon for the spool directory /var/spool/lpd .
>=20
> 8. I configured a printer as follows:
>    - Printer Driver Selection            [PS]
>    - Interface Setup                     [parallel], via /dev/lpt0
>    - Paper Format                        [a4]
>    - Printing Quality                    [medium]
>    - Color Mode                          [gray]
>    - Print Resolution in "dots per inch" [600x600]
>    - Default Printing Method             [ascii]
>=20
> 9. I printed a test page. Preparation took no time at all, printing,
>    however, lasted 4:33. It is a complex page, after all, and the=20
>    HP 1200 seems to be slightly underpowered.
>   =20
> 10. I installed that configuration under the name "ascii" and finished
>     the SETUP script for the time being.
>   =20
>     This is the generated printcap (comments stripped):
>   =20
>     ascii|PS;r=3D600x600;q=3Dmedium;c=3Dgray;p=3Da4;m=3Dascii:\
>         :lp=3D/dev/lpt0:\
>         :if=3D/etc/apsfilter/basedir/bin/apsfilter:\
>         :sd=3D/var/spool/lpd/ascii:\
>         :lf=3D/var/spool/lpd/ascii/log:\
>         :af=3D/var/spool/lpd/ascii/acct:\
>         :mx#0:\
>         :sh:

Why you named it ASCII ?

> 11. I started LPRng and found this line in syslog:
>=20
>     Jan 15 20:41:02 ser1 checkpc[73259]: ascii: Checkwrite: fcntl F_SETFL=
=20
>                 of '/dev/lpt0' failed - Operation not supported by device
> 			=09
> 	Similar output was generated by calling "checkpc -f". But sending
> 	data to the printer was never the problem, so I'm currently not
> 	much concerned about it.

Ask FreeBSD port maintainer, LPRng people.

> 12. I tried to print a simple text file ("lpr -Pascii /etc/printcap"),
>     but lpq said this:
> =09
> 	Status: cannot open '/dev/lpt0' - 'Permission denied', attempt 2,=20
> 		sleeping 20 at 20:48:37.238
>=20
>     I removed the job ("lprm 337")
> =09
> 13. I checked the permissions on /dev/lpt0: root.daemon 660.
>=20
> 14. Trying to find out what user LPRng's lpd runs as, I read a lot
>     of documentation in the build directory, only to find that it
> 	apparently setuid()'s itself to daemon.daemon, which ought to=20
> 	work.
> =09
> 15. In order to test if this made it work, I changed the permissions
>     on /dev/lpt0 to root.daemon 666, killed and restarted lpd, and
> 	tried again to print the text file. It worked, and the output=20
> 	looked fine. The F_SETFL error message appeared again.
> =09
> 16. A cursory glance at the source code showed that LPRng perhaps
>     does not -- as written in the LPRng-HOWTO -- set both uid and
> 	gid to daemon, but only the UID. In my case, it would then
> 	run as daemon.wheel, which can't possibly work.
> 	A less cursory glance at the output of "lpd -D4" showed that
> 	lpd does at least look up the correct GID of 1 for the
> 	daemon group.
>=20
> 17. I tested this idea:
>     - chown chris.chris /dev/lpt0; chmod 660 /dev/lpt0
> 	  (myself, to make sure that neither user nor group match)
> 	  - "permission denied"
> 	- chown chris.daemon /dev/lpt0
> 	  (may be the correct group)
> 	  - "permission denied"
> 	- chown daemon.chris /dev/lpt0
> 	  (may be the correct user)
> 	  - worked.
> 	So lpd sets the documented uid, but another gid.
> =09
> 	Unfortunately, ps apparently can't find out the effective gid
> 	of a process, so I had to settle for the real one, which is
> 	0 (wheel). But that didn't tell me anything, of course.
> =09
> 	- chown chris.wheel /dev/lpt0
> 	  (the suspected gid of 0)
> 	  - worked.
> 	Obviously, lpd succeeds only in changing the uid, but fails
> 	at the gid (if it tries at all, that is).
> =09
> 	I set the ownership to daemon.wheel to make at least that work.
> =09
> 18. I checked the LPRng changelog. Lo and behold, it mentions that
>     very bug as fixed in 3.7.6. Unfortunately, that is the version
> 	I installed. Let's blame it on a wrong fix. About time the LPRng
> 	port gets updated, the current release is 3.8.4.

Please tell the port maintainer.

> 19. Now for the client. Using SuSE's YaST configuration tool,
>     I configured a simple network printer:
> =09
> 	ascii|remote printer on ser1:\
>         :sd=3D/var/spool/lpd/ascii:\
>         :rm=3Dser1:\
>         :rp=3Dascii:\
>         :bk:sh:mx#0:
> 	=09
> 20. "lpq -Pascii" on the client showed that the printer status was
>     accessible.
> =09
> 21. "lpr -Pascii /etc/printcap" from the client produced the usual
>     staircased text. Even an "ASCII only" apsfilter configuration
> 	on the server didn't work, and still doesn't. Because the printer
> 	stopped blinking, I'm sure that it got the text file directly,
> 	without apsfilter in between.
>=20
> I'm out of ideas. What about you out there?

As workaround install apsfilter on the client, to compute print
data on the client, so that the correct data stream enters the
server.

You should try to contact Garance A Drosihn <drosih@rpi.edu>
to ask, since he did a lot on the FreeBSD spooling system.

Theoretically I think the input filter should be executed even
when getting print data via network. He can tell you, if there
is a bug in 4.4-RELEASE. Well now you installed LPRng on FreeBSD
which normally is not necessary, since FreeBSD's lpd is not so
"stock" and limited as all the other un-fixed versions around.

For example printing to a remote printer and using an input
filter is fixed in FreeBSD since a long time. So theoretically
you can stay with FreeBSD lpd, since its not so bloated like LPRng.
Not that its really bad, but I don't like it ....

Then additionally send this report to the LPRng port maintainer
so that an update gets releases.

I hope both can help you. BTW: I already put both on Cc: ...

Concerning lpd I'd remove the LPRng port if Garant has replied
to you and I'm sure, that he will be helpful to you. But then
you should re-install lpd from /usr/src, that shouldn't be a problem
with FreeBSD ...

Additionally you could then try to update to 4.5-RC, since then you
can both work on the latest and greatest -STABLE version of FreeBSD,
so that there every bug is shaken out ...

And I remember people have merged something from -current into the
printing subsystem, maybe this already helped.

And please use apsfilter 7.2.1.


	Andreas ///

--=20
Andreas Klemm
Apsfilter Homepage                       http://www.apsfilter.org
Support over mailing-lists (only!)       http://www.apsfilter.org/support
Mailing-list archive                     http://www.apsfilter.org/Lists-Arc=
hives
Songs from our band >> 64Bits <<         http://www.64bits.de
Inofficial band pages with add-on stuff  http://www.apsfilter.org/64bits.ht=
ml

--ew6BAiZeqk4r7MaW
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: Weitere Infos: siehe http://www.gnupg.org

iD8DBQE8RUOGd3o+lGxvbLoRAue6AJ4542/XLgKhKTZbv50MbYxlTS52BQCfZaMU
7D2TzTqMnPSSsxDE0m+Z4/c=
=Drrh
-----END PGP SIGNATURE-----

--ew6BAiZeqk4r7MaW--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020116091030.GA16535>