6 ms·
What 'dependency' means in Unix init systems is underspecified
- tlb 8y agoMake lets you specify all 3 kinds of dependencies. Requirement is the default, want can be had by prefixing the commands with - (ignore errors), and ordering can be had by putting the prerequisites after a |. 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.
- cperciva 8y agoOrdering is a nonportable extension, unfortunately.
- deleted 8y ago[deleted]
- Avamander 8y agoI think make is too much of a write-only language, it's also hard to debug and autogenerators (automake) create makefiles that are just abhorrent.
- zaphar 8y agoIt's not Make's fault that autogenerated Makefiles are hard to read. The same is true of pretty any much language produced by autogenerated code. It is possible to write perfectly reasonable and debuggable Makefiles if you do it by hand.
- orf 8y agoSame for assembly. Does that mean it's easy, intuitive and doesn't suffer from horrible pitfalls?
- teddyh 8y ago> Make could have been the engine behind a lot of unix infrastructure. Possibly, if the problem with file names containing spaces was fixed.
- nn3 8y agoOn SUSE Linux a few versions used Makefiles for parallelizing init scripts under sysvinit before they switched to systemd. 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.
- paulddraper 8y agoNot exactly. 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
- GlennS 8y agoI'm confused. Systemd has separate 'wants', 'requires', 'after', and 'before', which sounds like what's being asked for here?
- dralley 8y agoIf you reread the opening paragraph - the author is responding to part of a blog post which questioned why a separation between ordering and dependencies was necessary, and provides an example.
- userbinator 8y agoI wonder if any others here think the whole idea of requiring an "init system" seems overly complex and almost un-Unix-like for the average use-case of a personal Linux system, or even a single-purpose server? I've built a minimal but quite functional system (including networking, a GUI, etc.) with only "init=/bin/bash" and everything else that needs to be run at startup in /etc/profile. 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?
- akira2501 8y ago> and everything else that needs to be run at startup in /etc/profile. 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.
- toast0 8y agoIf you want the service supervised, there's supervisord or daemontools or while true ; do flakeyserver; done. 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.
- Too 8y agoWhile on the topic of underspecified dependencies, another thing usually missed when writing init dependencies is that it's not enough to just start the depending service, it also has to perform some actions before the actual dependency is fulfilled. This can some times take several seconds and many services don't feedback to the init system when it's done. With wants dependencies this isn't so critical but if you have requires it must be factored in.
- bonzini 8y agoWhich is why systemd discourages daemonizing in the service and introduces both socket units (so that you can always connect to the server socket, you do not need to wait for the child to call bind(2)) and a simple notification protocol.
- ahartmetz 8y agoThe socket stuff isn't much of a win for correctness though, in fact it has new failure modes. It is one of these things that is confidently advertised as a great benefit of systemd, but it is actually a quite subtle matter and requires thinking. (Remember inetd?) 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.
- JdeBP 8y agoThen there are cases where a service is intentionally shut down for a critical operation of some kind but a client connects to the socket, auto-starting the service in the middle of the critical operation. 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.
- JdeBP 8y agoI saw the original article when it came up at https://news.ycombinator.com/item?id=18303019 https://news.ycombinator.com/item?id=18303019 a couple of days ago. M. Siebenmann is articulating part of one of the points that I was going to raise. 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. * http://jdebp.eu./Softwares/nosh/guide/system-control.html http://jdebp.eu./Softwares/nosh/guide/system-control.html