If it’s only happening under systemd, then I’d argue it’s systemd’s fault.
On one side, you have shell scripts that are generally pretty simple (FreeBSD’s init is something like 1000-2000 LOC for the implementation, and a simple service script is tens of lines).
On the other side, you have a monolith that hit 1.3 million lines of code a few years ago, and has gotten more and more complicated since then.
Assuming the waits are not a bug, then they are a misconfiguration. When I gave up on using it, the manual was long, incomprehensible, and the small documented fraction of systemd’s behavior didn’t match the manual.
> On the other side, you have a monolith that hit 1.3 million lines of code a few years ago, and has gotten more and more complicated since then.
Just a nit, that 1.3 million lines was reported incorrectly. You can see some talk at https://news.ycombinator.com/item?id=21935186 and I remember a Poettering tweet saying that was including things like documentation. At the time systemd was under 500k lines; still big but not quite so huge.
I'm also not sure if that count was for the full repository (which contains multiple modular projects like systemd-resolved that are not required for systemd) or just the actual systemd bin.
By not using systemd, you just shift the complexity around. Now suddenly every program needs to be able to do the double-forking song-and-dance, track PID files, etc.
systemd suffers from the lack of systemic design, but it's still way better than the pile of scripts that it replaced.
Yep, that's exactly the mess I'm talking about. Scripts that are ALWAYS incorrect, incomplete, and unreliable.
For example, can it kill a runaway Apache process tree? Or safely confine the CGI scripts so that they don't cause the OOM killer to terminate the sshd?
And what happens if the "stop" command hangs indefinitely?
> And no need to track pid. It uses pgrep with the flags and the program name by default. I believe OpenRC does the same.
> Scripts that are ALWAYS incorrect, incomplete, and unreliable.
The BSDs have used it for years now and it works well enough
> Or safely confine the CGI scripts so that they don't cause the OOM killer to terminate the sshd?
That’s a different thing than service management. It’s handled by the login class of the program’s user which specify such things.
> And what happens if the "stop" command hangs indefinitely?
The logic for stop is in the rc.subr file. There’s a timeout for trying to send TERM, then it’s KILL.
> Facepalm.
How many services do you intend to run on a single machine/vm? rc is simple, use existing tooling, and it’s more of convenience than a new things you have to take care of. I run debian and while systemd works, I’m not sure I need all of those stuff.
> The BSDs have used it for years now and it works well enough
Not really.
> That’s a different thing than service management. It’s handled by the login class of the program’s user which specify such things.
So how do I make sure that HTTPD doesn't run away?
> How many services do you intend to run on a single machine/vm? rc is simple, use existing tooling, and it’s more of convenience than a new things you have to take care of.
> Now suddenly every program needs to be able to...
If by "every program" you mean "your init system", then sure. For example, OpenRC predates systemd by several years, can manage both forking and non-forking services, [0] and supervise non-forking programs with no PID files required.
[0] It even handles both s6 and systemd-style socket-based readiness notification.
Process supervision was not invented by systemd; worse still, it appears that systemd completely ignored earlier solutions in this field.
I was strongly disappointed and shocked when I realize that Lennart was not able to write something like "my solution is better or comparable to daemontools, because".
> Process supervision was not invented by systemd; worse still, it appears that systemd completely ignored earlier solutions in this field.
Facepalm^2. Do you remember the origin story of upstart and systemd?
Daemontools attempted to do similar things, but the only available tool for it was process groups versus cgroups. It also missed the service activation support.
Ekhem. "Service activation" thing was older than coal and rarely used, because of little usability at the time. It was called "inetd".
And to be precise - I'm not wrote, that daemontools and others already has support for cgroups (that was a moderate young concept, comparing to daemontools age). I'm pointing, that systemd author never admit that he draw a conclusions from prior work. I cannot talk about NIH syndrome even, because it was "I don’t even know that someone did this already".
> I'm pointing, that systemd author never admit that he draw a conclusions from prior work.
This is simply wrong. He wanted to contribute to upstart, so he obviously was aware of it. He also cited Apple's launchd as the inspiration for the socket-based activation.
I'm too lazy to dig in the archives, but I'm pretty sure Solaris' SMF and other init frameworks were also discussed.
I seriously dislike the current state of systemd, mostly because it became a giant mud ball of small services without clear boundaries. But let's not just invent nonsense.
> I was strongly disappointed and shocked when I realize that Lennart was not able to write something like "my solution is better or comparable to daemontools, because".
Oh, but he did! Didn't you see where he wrote over and over and over again «SystemD is better than everything else because it is the Modern Way to do Linux and everything else is Legacy Garbage.»? ;)
> If it’s only happening under systemd, then I’d argue it’s systemd’s fault.
Yep. For me, it's most often a 90 second delay that comes from the combination of the automagical conversion of fstab entries into services, an NFS mount in fstab, and an offline NFS server.
Sane init systems notice that this is a networked filesystem (I've even marked it with the _netdev option!) and don't hang the boot for a minute and a half screaming at a dead server. Systemd is anything but sane.
wouldn't that be the fault of the service it's waiting for and not systemd itself?