Login
You're viewing the functional.cafe public feed.
  • Nov 17, 2026, 1:16 PM

    There are now two management layers to the service: systemd and apachectl. And they have to agree on its state - and they don't. Because from systemd's point of view, it is a oneshot, not a longrun; it stopped as soon as apachectl start exited; so "reloading" makes no sense since the service is "not active". That is what happened to @mcc .

    And this is where systemd is wrong. If it has been given an ExecReload= directive, it should just run it, even if it thinks the service is inactive. If it really is, the reload command will error out and systemd can report the error. But systemd doesn't do that, because it doesn't understand that it's handling a oneshot - and ExecReload= only works for longruns. systemd does not handle the difference properly; if it did, the presence of an ExecReload= directive in a oneshot service file would at least raise a warning.

    Conclusion: systemd is bad, but we already knew that, and more to the point, this unit file is garbage, and simply does not work. Did nobody test it? Does anyone in FOSS test anything anymore? 9/12

    💬 3🔄 2⭐ 5

Replies

  • Nov 17, 2026, 1:17 PM

    So what would a working service file look like? Here's what I would do:

    • Study the apachectl layer: how is the httpd process started exactly? what command line is run, and how do subsequent apachectl invocations communicate with it? signals? (how does apachectl find the pid?) Unix domain socket? (how does apachectl know where the socket is?)
    • ExecStart= is a direct command line running httpd in the foreground, with Type=simple (or Type=notify for the daring, that will be for another thread). It is a real longrun, managed by systemd as idiomatically as possible.
    • Other ExecSomething= directives are written depending on the result of the apachectl analysis. With a little luck, some (or all!) of them are just signals, and the directives can be omitted entirely. KillSignal= may need to be adjusted, but that's all fine.
    • And that's it.

    But, but, this means I can't use apachectl directly!

    Well it looks like you already can't, so 🤷. Keep reading though.

    Wait, are you advocating for more integration with systemd? Who are you and what have you done with @ska ?

    Yes I am, because I am advocating for correctness, which is best done by good integration with the service manager, no matter what it is. systemd is trash, but if you're going to write service files for systemd, your service files should actually work with systemd, not be a half-assed shim to your half-assed 20 year old ad-hoc supervision system. Of course, you could also write service files for s6, yknow? Nobody's stopping you. 10/12

    💬 1🔄 3⭐ 8
  • Nov 17, 2026, 1:18 PM

    So what happens to apachectl, and to people who are used to it?

    Well, this kinda sucks. Service-specific control commands are a relic from the past; using supervision or service manager commands to address services is much better - this unifies the interface across services and makes it easy to define distribution policies; and modern supervision systems generally provide better guarantees than service-specific control commands, which are often not much more than three shell scripts in a trenchcoat to hack something that looks like supervision.

    That's... not a very satisfying answer, is it?

    It's possible to get a better one - but it requires effort. Since apachectl and similar control commands are not usable as is in a supervised world, people who provide the service files - whether the distribution, as it used to be and should still be, or upstream, which for some reason took up that burden and is often doing a bad job of it - should also provide replacements for control commands, written on top of service manager commands.

    So, instead of systemd invoking apachectl, it should be apachectl invoking systemctl.

    • apachectl start ➡️ systemctl start httpd
    • apachectl stop ➡️ systemctl stop httpd
    • etc.

    And yes, that requires a lot of writing for someone who supports different service managers - which is what distros should do because monocultures are bad. But the good news is that these can generally be pretty simple shims; this is far from complex or difficult code. 11/12

    (Edit: clarity)

    💬 1🔄 2⭐ 4
  • Nov 17, 2026, 1:20 PM

    I have been interested in supervision systems and service management since daemontools came out, which will soon be 30 years ago. I have written and maintained s6 for 15 years now, and every year I find some new issue, or some rabbit hole of complexity, and it always amazes me that starting daemons, a subject that on paper looks pretty straightforward, can be full of pitfalls and traps and subtle things, and I hadn't clocked it as a fractal subject but looking back, it certainly is. If I prepared a talk on it today, it might end up being more than 6 hours long.

    If the subject interests you, a good starting point is the 15-minute introductory video I gave at FOSDEM 2017: archive.fosdem.org/2017/schedu
    Some stuff is out of date (#s6 is on OFTC, not on Freenode anymore...) and omg did I really have such a French accent? but most of it holds up.

    Thanks for coming to this long-winded, rambling TED talk. This is what happens when I'm waiting for my laundry and scrolling fedi. 12/12

    💬 1🔄 4⭐ 16
  • 💬 0🔄 0⭐ 0
  • Nov 17, 2026, 4:12 PM
    @ska @mcc

    fwiw systemd does have `RemainAfterExit` for oneshots, that makes it then work like openrc works; a started service counts as started until stopped, even if there's no longrun attached; that should make the Reload command work i think, and map better to the notion of it being stateful (even though it's wrong here)

    tho i also wonder why systemd lets you stop a non-remain oneshot but not reload it? either that, or `systemctl stop apache` won't work either

    fwiw² gentoo's systemd unit file for apache does call apache2 -DFOREGROUND directly, not apache2ctl, so someone already did make it work
    💬 2🔄 0⭐ 0
  • 💬 0🔄 0⭐ 3
  • Nov 17, 2026, 9:15 PM

    @navi @mcc @ska

    I don't see any upstream systemd service at all, and the Debian one comes from the debian/ directory.

    By the way, Type=forking would be the real solution. "This daemon is grotty, assume it forks, woe unto you if you don't also specify PIDFile= to tell us how to stop it again".

    Meanwhile in debian/apache2.service land...

    Type=notify
    Environment=APACHE_STARTED_BY_SYSTEMD=true

    *Now* you may start crying.

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Nov 17, 2026, 4:22 PM

    @ska I understand why this system must be architected the way it was architected, but that doesn't mean I had a fun day yesterday.

    One problem perhaps bigger than any particular interface decision is that the interface to my applications was changed out from under me without me even knowing it (I still don't know when systemd appeared on my system; it wasn't there when I installed Linux on this server, and one day it was)

    💬 1🔄 0⭐ 0
  • Nov 17, 2026, 7:31 PM

    @mcc Yeah, that branches into the "distros are shit at respecting users' time and habits" rant, which I totally agree with, but it's not my area of expertise (it's more @gro-tsen.bsky.social 's). I stuck to the part of your story that I could provide lighting for. 😅

    💬 1🔄 0⭐ 1
  • Nov 17, 2026, 10:27 PM

    @ska @mcc @gro-tsen.bsky.social I don't think I have any particular expertise to bring (other than thank you for an instructive thread), but as far as communicating user wishes, I believe it ought to be possible to start/stop/restart Apache either with `systemctl` or `apachectl`, and, moreover, they should interact completely harmoniously with each other. I'm not saying I know *how* this can be done, but it *should*.

    💬 2🔄 0⭐ 0
  • Nov 17, 2026, 10:30 PM

    @ska @mcc @gro-tsen.bsky.social … Because this is a problem that has repeatedly plagued the Linux ecosystem at large: you have N different tools that more or less accomplish the same task (here, `systemctl` and `apachectl`), and the user is completely confused as to how they relate or interact (are they synonyms? incompatible? is one obsolete?). Such mazes should always be resolved by harmonious interaction between the tools.

    💬 0🔄 0⭐ 0
  • Nov 17, 2026, 10:34 PM

    @gro_tsen_test @ska @gro-tsen.bsky.social Actually, it is *possible* that newer versions of apachectl do work this way; I am using a somewhat old LTS, on this one system.

    This said there is some design difficulty here because systemd does what it does by *invoking* apachectl, so we'd need something wacky like a --no-really-im-systemd argument to apachectl. It gets awkward.

    💬 0🔄 0⭐ 0