You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by ad...@gmi.com on 2002/07/11 00:15:39 UTC

Solaris + chroot + /dev/null?

(Note that my question is at the bottom)

I'm having some strange behavior with Apache 1.3.26 (and previous versions, but I stay up to date) with regard to running apache inside a chroot on solaris 8, with all the latest patches.

Effectively, my error_log is filled with messages like this:
httpd: unable to replace stdin with /dev/null: No such device or address
httpd: unable to replace stdout with /dev/null: No such device or address

I launch apache with this command:

chroot $HTTPD -f $HTTPD_CONFIG

if I look at a truss output (aka strace on linux) I see:

20851:  open("/dev/null", O_RDONLY)                     Err#6 ENXIO
20851:  write(2, " h t t p d", 5)                       = 5
20851:  write(2, " :   u n a b l e   t o  ".., 42)      = 42
20851:  write(2, " N o   s u c h   d e v i".., 25)      = 25
20851:  write(2, "\n", 1)                               = 1
20851:  close(1)                                        = 0
20851:  open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) Err#6 ENXIO
20851:  write(2, " h t t p d", 5)                       = 5
20851:  write(2, " :   u n a b l e   t o  ".., 43)      = 43
20851:  write(2, " N o   s u c h   d e v i".., 25)      = 25
20851:  write(2, "\n", 1)                               = 1

where 20851 is the controlling process running as root (the parent of all the child webservers, the one that does logging, etc.)

so immediately, I thought it was a problem with my chroot, but:

# ls -laL dev/null
crw-rw-rw-   1 root     sys       13,  2 Jan  4  2002 dev/null

and

# ls -laL /dev/null
crw-rw-rw-   1 root     sys       13,  2 Jul 10 14:44 /dev/null

A quick glance at the man pages for open gives me:

     ENXIO The O_NONBLOCK flag is set, the named file is a  FIFO,
           the  O_WRONLY flag is set, and no process has the file
           open for reading; or the named  file  is  a  character
           special  or  block special file and the device associ-
           ated with this special file does not exist.

but its not a fifo, O_WRONLY is not set for the stdin (first instance above), and I don't think O_NONBLOCK is set, but I'm not sure.

# grep O_NONBLOCK truss_log
returns nothing, and:
# grep O_WRONLY truss_log
20851:  open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) Err#6 ENXIO
which we saw above.

effectively, my question is: why is this happening, how do I fix it?  Anyone running apache inside a chroot on Solaris out there without these errors?  (Note that when run with -X, this error doesn't happen, but that's because the parent process isn't running as root, there isn't a parent process, its just one running as the user.)

This isn't so much a problem, as flat apache-1.3.26 works fine, but when I happen to add apache-ssl, it barfs on startup.  I've tracked it down to this line, even with apache-ssl (ie: if i give it a file instead of a character device for /dev/null, it works, without errors on plain apache and apache-ssl)  Sadly, however, the apache-ssl mailing lists have been little help (i received one email from someone who wasn't running it in a chroot), but that didn't surprise me too much, as I didn't expect loads of people running solaris + chroot + apache, but I could be wrong on this.

This leads me to believe that its one of the below:
1.  a bug on apache running under chroot on solaris
2.  a bug in chroot on solaris
3.  something I am doing wrong

if it is 1, i would like to fix/help/have it fixed/etc.
if it is 2, i will somehow need to document it, so I can have Sun fix chroot.
if it is 3, just tell me what I'm doing wrong!  whee!

if you need more information, just ask.  thanks in advance.

thanks,
adam

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Solaris + chroot + /dev/null?

Posted by Arin Komins <ak...@midway.uchicago.edu>.
On 10 Jul 2002 adam-apacheusers@gmi.com wrote:

:Subject: Solaris + chroot + /dev/null?
:
:(Note that my question is at the bottom)
:

[snip]

:This leads me to believe that its one of the below:
:1.  a bug on apache running under chroot on solaris
:2.  a bug in chroot on solaris
:3.  something I am doing wrong
:
:if it is 1, i would like to fix/help/have it fixed/etc.
:if it is 2, i will somehow need to document it, so I can have Sun fix chroot.
:if it is 3, just tell me what I'm doing wrong!  whee!
:

I've got it running successfully inside a chroot (using modssl) on Solaris
8.

My /dev/null is a symlink over to /devices/pseudo/mm@0:null (in my chroot
;-) )  same perms on the mm@0:null character special file.

Just to check, you didn't patch or do anything that might've changed the
/dev/null outside your chroot?

Thanks,

Arin
-- 
------------------------------------------------------------------
Arin Komins			       	      akomins@uchicago.edu 
Manager of Web Systems Architecture
University of Chicago/NSIT			tel: (773)834-4087
1155 E. 60th St. #302B Chicago, IL 60637	fax: (773)702-0559
------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org