weird chroot problem with apache
Hi, I'm having weird problems with chrooting apache, this is the output
of strace
newbs:/chroot/httpd# strace chroot /chroot/httpd /usr/sbin/httpd
-f /etc/apache/httpd.conf
execve("/usr/sbin/chroot", ["chroot", "/chroot/httpd", "/usr/sbin/httpd", "-f", "/etc/apache/httpd.conf"], [/* 13 vars */]) = 0
uname({sys="Linux", node="newbs.org", ...}) = 0
brk(0) = 0x804b2ec
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40017000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=13369, ...}) = 0
old_mmap(NULL, 13369, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40018000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360^\1"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1244688, ...}) = 0
old_mmap(NULL, 1254852, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001c000
old_mmap(0x40144000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x127000) = 0x40144000
old_mmap(0x4014c000, 9668, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4014c000
close(3) = 0
munmap(0x40018000, 13369) = 0
brk(0) = 0x804b2ec
brk(0x806c2ec) = 0x806c2ec
brk(0) = 0x806c2ec
brk(0x806d000) = 0x806d000
chroot("/chroot/httpd") = 0
chdir("/") = 0
execve("/usr/sbin/httpd", ["/usr/sbin/httpd", "-f", "/etc/apache/httpd.conf"], [/* 13 vars */]) = -1 ENOENT (No such file or directory)
write(2, "chroot: ", 8chroot: ) = 8
write(2, "cannot run command `/usr/sbin/ht"..., 36cannot run command `/usr/sbin/httpd') = 36
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
) = 1
exit_group(127) = ?
newbs:/chroot/httpd# ls -l ./usr/sbin/httpd
-rwxr-xr-x 1 root root 480140 Jul 22 12:16 ./usr/sbin/httpd
#
/chroot/httpd/etc/apache/httpd.conf exists and so does /chroot/httpd/usr/sbin/httpd
the thing i noticed about the output of strace was it read()'s the first 512 bytes of the apache ELF binary, but then prints ENOENT.
any ideas? i've tried copying a staticly compiled version of /bin/sh to the chroot but the same thing happens.
Reply to: