Comment 0 for bug 1832182

Revision history for this message
RedScourge (redscourge) wrote :

When starting or restarting Apache via the /usr/sbin/apache2ctl script, systemd becomes unaware of the state of Apache, causing "systemctl status apache2.service" to report "Active: inactive (dead)". Below I describe the issue and a fix; attached is the output of the diff command after I fixed it on my own 18.04 LTS system.

Description of issue and impact:

Despite this issue, Apache itself generally runs fine, so this is not an absolutely critical issue, however as both "systemctl status apache2.service" and "service apache2 status" become unable to detect its running state, and as some people may be scripting Apache service checks using those commands, they may experience server outages when they migrate from 14.04 LTS to 16.04 LTS or 18.04 LTS, so this could potentially have serious consequences. I suspect this caused or at least contributed to at least one outage of a web server I am responsible for, as the web file backup script was unable to restart the apache process after stopping it.

This issue affects Ubuntu 16.04 LTS when using "apache2ctl start" or "apache2ctl graceful", and Ubuntu 18.04 LTS just when using "apache2ctl graceful".

Fix:

The fix is made somewhat obvious due to the fact that the issue was fixed for "apache2ctl start" in 18.04 LTS , by replacing the regular call which resolves to "/usr/sbin/apache2 -k start" with a check for presence of systemd, followed by invoking "systemctl start apache2.service" if that check is affirmative, or falling back to the old start command if that check is negative.

Attached is a diff of the file before and after I copied the fixed invocation from the "star"t subsection to the "graceful" subsection in 18.04 LTS. A fix for 16.04 LTS would require copying that block both into the "start" and "graceful" subsections.

Additional information:

lsb_release -rd :

Description: Ubuntu 18.04.2 LTS
Release: 18.04

apt-cache policy apache2:

apache2:
  Installed: 2.4.29-1ubuntu4.6
  Candidate: 2.4.29-1ubuntu4.6