lpr: unable to create temporary file / was: Re: [Xprint] Xprint
009.001 test canidate builds...
Aleksander Adamowski
aleksander.adamowski.xprint at altkom.pl
Tue Jul 13 18:31:09 EDT 2004
Roland Mainz wrote:
>I still cannot reproduce the problem.. nor did David. And I've spend a
>whole day at SuSE last week and we weren't able to reproduce the problem
>there either... ;-(((
>We need something like "truss" or "strace", watch Xprt+lpr (e.g. all
>child processes launched by Xprt) and dump everything to a log... maybe
>that gives a hint what's going wrong...
>
>
On Mandrake Cooker, I've successfully isolated two issues.
1) during system startup, when the xprint initscript is executed, Xprt
cannot contact the cups server because the cupsd has'nt managed to start
yet. Startup scripts of CUPS and XPrint have dangerously close priorities:
# ls /etc/rc5.d/ | grep ^S | egrep "(xprint|cups)" | sort
S-1xprint@
S60cups@
S61xprint@
I propose to lower the default start priority level of xprint init
script, from 61 to 50 or even less, so it stars up earlier.
CUPS starts with priority 60 on Mandrake and 55 on Fedora Core 1. Or
even better, XPrint could retry connecting to the CUPS server in a
couple of seconds instead of failing instantly.
For example, Xprt could try to connect 3 times, with 5 seconds long
pause between 1st and 2nd try, and 30 seconds pause between 2nd and 3rd try.
This issue has been causing the syslog message "Xprt_33: lpstat: Unable
to connect to server: Connection refused". Please, make this message
more descriptive - it should contain the address of the CUPS server that
is contacted.
2) I did a "strace -f" of Xprt process and have discovered that XPrint
first changes its uid to the user that has submitted the job for
printing and executes lpr:
[pid 7402] setuid32(501) = 0
[pid 7402] execve("/usr/bin/lpr", ["/usr/bin/lpr", "-P",
"unix_17p_HPLJ2100", "-#1", "-T", "PS printing testcase"], [/* 55 vars
*/]) = 0
, and then lpr fails because it tries to write to a temporary directory
owned by root:
[pid 7402] open("/root/tmp/40f3f94f5c478", O_RDWR|O_CREAT|O_EXCL, 0600)
= -1 EACCES (Permission denied)
[pid 7402] write(2, "lpr: unable to create temporary "..., 38) = 38
Seems that XPrint executes lpr with the environment configured from the
root user's settings (I've started xprint using the /etc/init.d/xprint
restart). I have the root user's TMP, TMPDIR and SCREENDIR variable set
to /root/tmp. Possiblt the xprint startup script or Xprt binary itself
can sanitize its environment, especially any variables that can affect
the local printing system's tools?
The syslog message here is generated by CUPS's lpr, so CUPS (not XPrint)
guys need to make this error message more descriptive.
--
Best Regards,
Aleksander Adamowski
GG#: 274614
ICQ UIN: 19780575
http://olo.ab.altkom.pl
More information about the Xprint
mailing list