What 'dependency' means in Unix init systems is underspecified
utcc.utoronto.ca
utcc.utoronto.ca
foo : requirement want | ordering
requirement:
generate $@
want:
- generate $@
ordering:
generate $@
Make could have been the engine behind a lot of unix infrastructure. I suspect the language-specific stuff like VPATH made it an undesirable choice.Possibly, if the problem with file names containing spaces was fixed.
I've been using make to drive test scripts myself recently, although i often regret it because other people editing them often make quite a mess later.
GNU Make's order only dependency is different than what is described.
If `foo` is requested, `ordering` will be requested.
However the last modified time of `ordering` will not affect whether `foo` is rebuilt.
There's no analogy of the last modified caching of make products to in it systems here
It is possible to write perfectly reasonable and debuggable Makefiles if you do it by hand.
In that world, the dependencies are easily expressable in the shell script itself: requirement is &&, want is ;, and ordering is simply... the order in which the commands appear in the file. It feels very much in line with the Unix philosophy. Thus the relative complexity of all the other "init systems", even including the original sysvinit, seems rather excess to me --- was it just a case of Linux/Unix originating with multiuser servers and retaining all of the baggage from that when it became a personal OS?
Those are unmanaged services, if they crash for any reason, they won't be restarted? For embedded use cases this is probably fine, but for desktop it is a problem.
> In that world, the dependencies are easily expressable in the shell script itself [...] It feels very much in line with the Unix philosophy.
This is why I use runit and let the program determine it's own dependencies. If it fails to start, runit will try again in 1 second... forever. This actually works great in practice, but it does present a problem for "on-demand" services.
They can still be built, but I've always avoided them for the problems they present. For typical 'inetd' applications, I find ucspi-tcp to be an ideal solution for everything else I try to find some reasonable compromise which for most of the cases where I need a true managed set of services is very rare.
> and retaining all of the baggage from that when it became a personal OS?
It's worse in my mind, they're pantomiming the competition which seems to be a complete misunderstanding of the platform they're using.
On the other hand, some servers are expected to work, and if they crash, it should be investigated, because it's probably a big deal. In my experience auto-restart goes hand in hand with never investigate why it restarts. Sometimes that's appropriate (for software you basically have to run, but don't control), but more often it's terrible.
Or systemd, which is fine for many use cases.
2) based on the train of horrors for every single network daemon they write, do you trust that their systems level code is somehow good?
3) well their record on systems level code isn't that great either, username parsing really didn't go well
4) is systemd demonstrating engineering excellence of as simple as possible, but no simpler?
5) out of the box, my experience with Debian + systemd + a crashy service (from packages) was that the specific crashes I was getting didn't result in a restart, because it got a segfault instead of simply exiting. --- also, it changed the boot process so I couldn't ctrl-c out of slow things, so that was net negative.
It was simple, but it was also error-prone because you're re-inventing the logic every time. And it made it really difficult to automatically install software because instead of dropping a file into a directory, you had to programmatically edit a common file. Installer scripts would do all kind of horrible things like "cat myscript >> /etc/rc.local". The situation forced software maintainers into doing something (automated editing of code) that they weren't skilled at, with tools (Unix commands) that weren't very well suited for it.
Having a more data-driven, standardized approach split up into multiple files was a huge improvement from a maintainability standpoint. Yes, it's more complicated, but in my opinion the complexity was easily worth it.
And by the way, its predecessor, with insserv and startpar, also supported parallel execution of init scripts.
This is exactly how other init systems work such as s6 which uses chain-loading with execline or arsv minitools init that uses a minimal custom shell call msh.
EDIT: added supervision/restart
For what it's worth, the nosh doco does try to articulate the difference between the dependencies of wants/, conflicts/, et al. and the ordering relationships of before/ and after/. The former control the extent of the set of jobs that system-control constructs for an action, whilst the latter control the order that the jobs in that set are then executed in.
Systemd has separate 'wants', 'requires', 'after', and 'before', which sounds like what's being asked for here?
With wants dependencies this isn't so critical but if you have requires it must be factored in.
Socket activation is more meant to allow for on-demand starting of services without losing connections -- and the design shows that this is the main purpose. For many services, "having a connection" doesn't mean the service is ready yet.
I think that having a notification system for a service to tell the init system it is ready would be nice, though the "obvious" way of doing it (rt signals) wouldn't work for unprivileged services.
It looks like it has grown a bit since the last time I saw the manpage...
What if something else relies on the socket being open to mean that the service is fully running including e.g. side effects on disk? What if a service made on-demand with socket activation is supposed to have low latency on the first request? There is a reason why inetd disappeared long before systemd appeared. The saved memory (that is how long ago it was) wasn't worth the brittleness and complication anymore.
Debian hit this some years ago in its conversion to systemd. It took the existing van Smoorenburg rc notion of temporarily stopping services during a package upgrade and translated that in the straightforward manner to systemd units. People started hitting services that got restarted in the middle of a package upgrade, causing various unwanted side-effects. So the Debian mechanism had to be changed to detect the existence of systemd and stop/start the socket units as well as, or sometimes instead of depending from the service, the service units.
Package upgrades are not the only places where one hits this. It is important that socket/path/automount/timer units be stopped as part of the shutdown process, not just service units, otherwise one can end up with shut down services being started back up by the sockets/paths/automounts/timers late in the shutdown process, potentially deadlocking it, and at least lengthening it by a significant amount.
Huh. You’d think the more correct thing to do would be to do “systemctl --runtime --now mask $service; $DO_THING; systemctl --runtime unmask $service; systemctl start $service”. Or, even more correct, first detect if the service is running, then do the above, except only start the service again if it was running previously.
In fact, the Debian people created two extra programs named deb-systemd-helper (with the same enable/disable/mask/unmask syntax as systemd's own systemctl) and deb-systemd-invoke (with the same start/stop/restart syntax as systemd's own systemctl) for performing all of these actions over package upgrades, employing a parallel set of service symbolic link farms.
* https://manpages.debian.org/stretch/init-system-helpers/deb-...
* https://manpages.debian.org/stretch/init-system-helpers/deb-...