1826214 Members
2731 Online
109691 Solutions
New Discussion

Re: lp can't open file

 
SOLVED
Go to solution
George Liu_2
Frequent Advisor

lp can't open file

very frustrated by this problem.

#uname -a
HPUX 10.20

#cd /etc
#lp hosts
#can't open hosts

#lp /etc/hosts
print OK

#which lp
/usr/bin/lp

#more hosts
display hosts OK

Any idea is appreciated.
25 REPLIES 25
Dave La Mar
Honored Contributor
Solution

Re: lp can't open file

And the permissions on this file are?
And the user issuing these commands has what permissions?

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
George Liu_2
Frequent Advisor

Re: lp can't open file

And the permissions on this file are?
world-readable
-rw-r--r--
And the user issuing these commands has what permissions?

root

Notice #
Dave La Mar
Honored Contributor

Re: lp can't open file

And your term type is what, as displayed by env?
Don't give up George, we'll get it.

Regards,

dl
"I'm not dumb. I just have a command of thoroughly useless information."
George Liu_2
Frequent Advisor

Re: lp can't open file

I am remotely logining, so the term is vt100
Thanks.
Dave La Mar
Honored Contributor

Re: lp can't open file

This is a good one George. I have to guess it is the remote login environment causing this.
Can you more and vi any other file when logging remotely?

After issue of the lp command, is the print in the print queue?

We'll get this!

dl
"I'm not dumb. I just have a command of thoroughly useless information."
Wina A. Buenavista
Occasional Advisor

Re: lp can't open file

u may try:
cd /etc
lp ./hosts
wina
George Liu_2
Frequent Advisor

Re: lp can't open file

lp ./hosts

doesn't work either. Same error message

cannot open file hosts

However, I still can more or cat or vi hosts

by

more hosts

The permission of hosts is
rw-r--r--


Thanks.
John Dvorchak
Honored Contributor

Re: lp can't open file

I am curious is someone hadn't put a "wrapper" on /usr/bin/lp. Could you publish an ll of /usr/bin/lp.
Here it is on one of my 10.20 boxes:

root> uname -a
HP-UX chop B.10.20 A 9000/715 2001081504 two-user license
chop:[ /etc ]
root> ll /usr/bin/lp
-r-sr-xr-x 1 root bin 45056 Nov 2 2001 /usr/bin/lp
chop:[ /etc ]
If it has wheels or a skirt, you can't afford it.
John Dvorchak
Honored Contributor

Re: lp can't open file

root> what /usr/bin/lp
/usr/bin/lp:
$Revision: 78.29.1.96 $
PATCH_10_20: hpux_rel.o lp.o 01/11/02


Forgot to "what" it for you.
If it has wheels or a skirt, you can't afford it.
George Liu_2
Frequent Advisor

Re: lp can't open file

# what /usr/bin/lp
/usr/bin/lp:
$Revision: 78.29.1.89 $
PATCH_10_20: hpux_rel.o lp.o 01/08/08


# ls -l /usr/bin/lp
-r-sr-xr-x 1 root bin 45099 Aug 8 2001 /usr/bin/lp

Thanks.
John Poff
Honored Contributor

Re: lp can't open file

Hi,

What is your permissions on /etc? What does 'ls -ld /etc' return?

Also, what does 'echo $CDPATH' return?

JP
George Liu_2
Frequent Advisor

Re: lp can't open file

# ls -ld /etc
dr-xr-xr-x 25 bin bin 6144 Apr 11 11:51 /etc

# echo $CDPATH
CDPATH: Undefined variable.


Thanks.
John Poff
Honored Contributor

Re: lp can't open file

Hi,

I'm stumped. Has this problem just happened recently? If so, what has changed on the box lately? Patches? Any config files modified such as root's .profile, etc.?

JP
George Liu_2
Frequent Advisor

Re: lp can't open file

Frankly I don't know. Only few people rarely use this box, and fewer chances to use printer. Thanks.

BTW, Does lp use $CDPATH to search the file or some other methods?
John Poff
Honored Contributor

Re: lp can't open file

Hi,

The CDPATH is used for searching paths for the cd command to change directories. It was a wild guess.

Do you have a default destination set for your lp printing? Also, does lp have the same problem with other files in /etc or does it print them? For example, can you do:

cd /etc
lp services

or does that complain also?

JP
George Liu_2
Frequent Advisor

Re: lp can't open file

Yes. lp has problem for all files if using syntax

lp filename
or
lp ./filename

but it works for syntax like

lp /directory/filename

Thanks.
John Poff
Honored Contributor

Re: lp can't open file

Ok. Does lp work for printing files from other filesystems? For example, can you go to /var/adm and find some small file to print there? I'm curious to see if it is just a problem in the /etc filesystem or if it happens in other filesystems as well.

Also, do you have a default printer destination set for your lp spooler, or is it undefined?

JP
Bill Douglass
Esteemed Contributor

Re: lp can't open file

I don't have a 10.20 system to test, but tracing lp on HP-UX 11.0 indicates that the process does a stat and access syscall on the file in question as user lp, group lp.

It also (as lp) tried to link the file to /var/spool/lp/request//. If that fails (cannot link across file systems), then it copies the file instead.

If you have it installed, it would be helpful to see a trace output from running "lp host". If you don't have it, you can d/l it from

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/trace-1.6/
George Liu_2
Frequent Advisor

Re: lp can't open file

Thank you, all.

All accounts except lp can't open a directly file in all directories.

If I
su - lp
then
lp filename
works just fine.

Maybe need to patch now.

I'm installing a tracing tool to try. Thanks.
John Dvorchak
Honored Contributor

Re: lp can't open file

Just a shot in the dark, have you tried bouncing lp:

/sbin/init.d/lp stop
/sbin/init.d/lp start
If it has wheels or a skirt, you can't afford it.
Yogeeraj_1
Honored Contributor

Re: lp can't open file

hi,

tried on my 10.20, and here is what i get:
============================================================
K250: home/yd>lp /etc/hosts
lp: no system default destination
K250: home/yd>lp -dit1 /etc/hosts
request id is it1-2963 (1 file)
K250: home/yd>what /usr/bin/lp
/usr/bin/lp:
$Revision: 78.29.1.55 $
PATCH_10_20: hpux_rel.o lp.o 99/06/09
K250: home/yd>ls -l /usr/bin/lp
-r-sr-xr-x 1 root bin 45056 Jun 9 1999 /usr/bin/lp
K250: home/yd>uname -r
B.10.20


============================================================

[works fine]

Most probably a patch issue. Did it work previously?

if not, maybe a little trace would help....

Best regards
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
John Poff
Honored Contributor

Re: lp can't open file

Hi,

I've thought of a couple of more things to try. Do you have your lpsched daemon started with the -v option? If not, you could stop it and restart it with -v so that it will log requests to /var/adm/lp/log. That might help give a clue about what is happening.

The more I think about it, the more it seems like a permissions problem somewhere, since lp can open files with the full pathname but not just the filename. Here's a couple more things to check. What does 'ls -ld /' return, and what does return? Also, what does the entry for lp look like in your /etc/passwd file?

JP
George Liu_2
Frequent Advisor

Re: lp can't open file

Thank you for all responses.
I thought most of the possibilities and now I think patches in somewhere might cause the problem.

When I ran trace, I got the following logs ONLY, which may imply deeper problem somewhere.

chinook(root):/ 1# /opt/trace/bin/trace lp -dlab11 backuplogs
lp: can't open file backuplogs
KI_TRACE_GET: Bad address

Thanks.
Gary Price
Occasional Contributor

Re: lp can't open file

I'm not sure if this issue was ever resolved, but I previously had the same. The root cause was no system default was assigned. I used lpadmin to define a default to resolve the issue.

lpadmin -d{your default printer here}

Gary