Uncategorized

Apache-2.2.10 + Mod_chroot-0.5 causes startup problems.

Today I tried to update apache-2.2.9-r1 to apache-2.2.10 and was greeted with the following errors in the error_log:


[Sat Jan 10 09:37:30 2009] [notice] mod_chroot: changed root to /var/chroot/apache.
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8j mod_chroot/0.5 Apache configured -- resuming normal operations
[Sat Jan 10 09:37:30 2009] [alert] Child 24458 returned a Fatal error... Apache is exiting!

Today I tried to update apache-2.2.9-r1 to apache-2.2.10 and was greeted with the following errors in the error_log:


[Sat Jan 10 09:37:30 2009] [notice] mod_chroot: changed root to /var/chroot/apache.
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [alert] (2)No such file or directory: Can't chdir to /var/chroot/apache
[Sat Jan 10 09:37:30 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/2.2.10 OpenSSL/0.9.8j mod_chroot/0.5 Apache configured -- resuming normal operations
[Sat Jan 10 09:37:30 2009] [alert] Child 24458 returned a Fatal error... Apache is exiting!

This is very strange to me. /var/chroot/apache definitely exists on the system, and after it apparently set the root to /var/chroot/apache it bombed. I thought doing a strace might give me a few more clues. Here is a snip of the more interesting lines:


26148 stat64("/var/chroot/apache", {st_mode=S_IFDIR|0755, st_size=288, ...}) = 0
26148 stat64("/var/chroot/apache", {st_mode=S_IFDIR|0755, st_size=288, ...}) = 0
26149 chroot("/var/chroot/apache") = 0
26150 chdir("/var/chroot/apache") = -1 ENOENT (No such file or directory)

At first apache stats /var/chroot/apache and appears to find it. Later it creates the chroot and doesn’t complain, and then finally, it trying to change directory to it, and fails stating that it’s not there. It almost appears that after apache is jailed it’s trying to reference the directories, which wouldn’t be available after the process has been jailed. Rolling back apache back to 2.2.9-r1 returns things back to normal. It definitely appears that it’s related to apache-2.2.10. I created a bug entry and posted a thread at the Gentoo forum:

http://bugs.gentoo.org/show_bug.cgi?id=254450
http://forums.gentoo.org/viewtopic-t-725855.html

I saw someone with a similar problem here (view comments):
http://www.cyberciti.biz/tips/chroot-apache-under-rhel-fedora-centos-linux.html/comment-page-1#comment-146644

Any help resolving the problem is greatly appreciated!
hanji