3

As of 20.04, the systemd service definition for apache2 (focal-updates Launchpad link) uses apachectl stop for ExecStop. This corresponds to the immediate, connection-disrupting TERM signal, instead of the graceful WINCH shutdown signal provided by apachectl graceful-stop.

Why is this? It seems to me like it's more sensible to do graceful shutdowns by default, especially since the same systemd service file specifies ExecReload to do a graceful restart instead of the abrupt restart. Also, nginx uses the graceful shutdown QUIT signal for its own ExecStop config.

There may well be a documented discussion in some mailing list about this decision, but I'm new to exploring the Ubuntu dev community platforms so I don't know yet where to look. (Maybe it's a design decision inherited from Debian, but I also can't tell.)

As a secondary question: if I want to update this service config for Apache (or any Ubuntu systemd service in general), how do I go about it in a safe, ‘Ubuntu-approved’ manner? (i.e., ensure it won't be overwritten by updates, etc.)

1 Answers1

2

Update: Debian bug #974665 has been resolved, so as of version 2.4.46-2 in Debian unstable, httpd now uses graceful-stop by default. I expect Ubuntu to inherit this change starting with 21.04.


Well, I've found my way around the Ubuntu and Debian dev platforms.

Ubuntu inherits this systemd configuration from Debian, and I've traced the initial work to configure systemd for apache2 to Debian bug #798430. In the discussion for that, the initial proposed patches actually specified graceful-stop/SIGWINCH; however, the final change committed is what we have now, and there was no specific mention of why the non-graceful command was used in the end. I found another, earlier bug report, #641206, requesting a similar change but for init.d, and the Debian maintainer replied, explaining why it was not feasible then. I'm not sure if it applies to systemd too; in any case I have filed #974665.

As for the follow-up concern, it appears that it can be done with the help of Debian ‘diversions’ and the dpkg-divert tool. Update: while 'diversions' may work, the easier and more conventional way to override systemd configurations is to use systemctl edit; see this answer about overriding systemd services.