Fix "graceful" action in init script when mod_chroot is enabled

Bug #687275 reported by Daniel Hahler on 2010-12-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)
Medium
Unassigned

Bug Description

Binary package hint: apache2

The init script uses "$APACHE2CTL graceful $2" to gracefully restart/reload Apache.

This will fail however when using mod_chroot (where Apache itself gets chrooted), and therefore the init script should fallback to "restart" in this case for "reload", "force-reload" and "graceful".

This might get done by adding the following code to "reload":
 if [ -f /etc/apache2/mods-enabled/mod_chroot.load ]; then
    # mod_chroot is loaded. "graceful" won't work.
  apache_restart
 else
  # normal reload code
 fi

The current block from "restart" would get abstracted into a "apache_restart" function, which would get called in case mod_chroot is loaded/enabled and for when "restart" itself is requested.

I have code like this in the "dpkg-old" init script, but do not remember if I had written it myself.

This should get forwarded/applied to the Debian package, too - I'd just like to get some feedback before forwarding it.

Scott Moser (smoser) on 2010-12-09
Changed in apache2 (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Stefan Fritsch (sf-sfritsch) wrote :

Which version of apache are you using? Since 2.2.10, it supports chroot without additional modules. And if that breaks graceful restart, that should be fixed.

Daniel Hahler (blueyed) wrote :

That would be nice to have as a built-in functionality, but apparently it differs from mod_chroot.

I have added "ChrootDir /var/www" to /etc/apache2/conf.d/my_defaults, but it seems like the fastcgi processes now get started outside of the chroot / before Apache chroots:

I am getting the following error (only /var/www/usr/lib/libc-client.so.2007e exists, not /usr/lib/libc-client.so.2007e):
/var/www/bin/php4-fcgi: error while loading shared libraries: libc-client.so.2007e: cannot open shared object file: No such file or directory

Apart from that there appears to be another problem, fastcgi processes (PHP) return "Service Temporarily Unavailable", while requests to normal resources (image) work fine.

This is likely also related to the order in which chrooting and spawning the fastcgi processes happens.

I am using mod_fastcgi.

Clint Byrum (clint-fewbar) wrote :

Dropping from "Triaged" to "Confirmed". This bug likely needs to be verified on recent versions of apache2 and forwarded before fixing it.

Changed in apache2 (Ubuntu):
status: Triaged → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers