Hacker News new | ask | show | jobs
by cyberax 21 days ago
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.

3 comments

This is the whole service management for OpenBSD

https://github.com/openbsd/src/blob/master/usr.sbin/rcctl/rc...

Then you got the initialization script

https://github.com/openbsd/src/blob/master/etc/rc

Service file can be very small

https://github.com/openbsd/src/blob/master/etc/rc.d/httpd

Powered by

https://github.com/openbsd/src/blob/master/etc/rc.d/rc.subr

Also daemon(3) for running as a system service

https://man.openbsd.org/daemon.3

And no need to track pid. It uses pgrep with the flags and the program name by default. I believe OpenRC does the same.

https://github.com/openbsd/src/blob/f5d74fd467fccdfc60b450a7...

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.

Facepalm.

> 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.

Quite often more than one. systemd makes it easy.

> 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.

> It was called "inetd".

And dbus -among the many other things it does- reinvented it again. It's kind of a mess there, too.

> 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.»? ;)