News for hackers. Stuff that matters.
Re:What 'dependency' means in Unix init systems is underspec... by userbinator on Saturday October 27, 2018 @10:49PM (#18318884)
I 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?

Re:What 'dependency' means in Unix init systems is underspec... by akira2501 on Saturday October 27, 2018 @11:32PM (#18319046)
> 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.

Re:What 'dependency' means in Unix init systems is underspec... by toast0 on Sunday October 28, 2018 @12:24AM (#18319173)
If 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.

Re:What 'dependency' means in Unix init systems is underspec... by newacctjhro on Sunday October 28, 2018 @03:19AM (#18319503)
> If you want the service supervised, there's supervisord or daemontools or while true ; do flakeyserver; done.

Or systemd, which is fine for many use cases.

Re:What 'dependency' means in Unix init systems is underspec... by toast0 on Sunday October 28, 2018 @11:31AM (#18321056)
1) can you use systemd to supervise a single process without adopting most of systemd?

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.

Re:What 'dependency' means in Unix init systems is underspec... by jakeogh on Sunday October 28, 2018 @04:22PM (#18322920)
Personally, if a service crashes, I want it to stay dead. Otherwise it's less likely to get fixed.
Re:What 'dependency' means in Unix init systems is underspec... by adrianmonk on Sunday October 28, 2018 @12:43PM (#18321427)
This is how things used to be done in the old days, for example on SunOS 4.x. At least for any software you added to the system, where you'd add a line to /etc/rc.local.

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.

Re:What 'dependency' means in Unix init systems is underspec... by Too on Sunday October 28, 2018 @02:50AM (#18319446)
With that method you can only express 1-1 relationships. Usually in real systems you have N-M. Your method is also linear, it has to wait for one line to complete before running the next even though they don't depend on each other. Parallel execution is one of the reasons systemd boots so much faster than it's predecessor.
Re:What 'dependency' means in Unix init systems is underspec... by rleigh on Sunday October 28, 2018 @06:59AM (#18320111)
Except that it doesn't, in practice, boot any faster at all. Most times I measure it, it's actually slower.

And by the way, its predecessor, with insserv and startpar, also supported parallel execution of init scripts.

Re:What 'dependency' means in Unix init systems is underspec... by Too on Sunday October 28, 2018 @08:11AM (#18320293)
Not familiar with insserv or startpar but there is a difference between supports and supports. Most systems support everything in the sense that it's turing complete but it should be easy to do it without creating spaghetti also. Not saying systemd is the best or only system that can do this, it was just an example, but older ones usually make it very messy.
Re:What 'dependency' means in Unix init systems is underspec... by rleigh on Sunday October 28, 2018 @08:56AM (#18320397)
It was supported for many years by the LSB standard init headers which were used to compute a dependency graph for parallel execution.
Re:What 'dependency' means in Unix init systems is underspec... by nwmcsween on Sunday October 28, 2018 @12:17AM (#18319158)
> ...only "init=/bin/bash"...

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.

Re:What 'dependency' means in Unix init systems is underspec... by justinjlynn on Sunday October 28, 2018 @06:36AM (#18320027)
True, but you do need to make sure to handle signals properly - there are special requirements for PID 1. https://github.com/Yelp/dumb-init/blob/master/README.md has a niceish explanation.
Re:What 'dependency' means in Unix init systems is underspec... by JdeBP on Sunday October 28, 2018 @06:58AM (#18320107)
It's one that repeats two common errors, though. The first error is obvious, as it is a major point claimed. The second error is forgetting that another of the actual major responsibilities of process #1 is system management, in particular various necessary initialization and finalization tasks, that (pertinently for this discussion) init=/bin/bash does not perform but that proper emergency modes do.

* https://unix.stackexchange.com/a/197472/5132

Re:What 'dependency' means in Unix init systems is underspec... by MisterTea on Sunday October 28, 2018 @01:47AM (#18319331)
If you want the best of both worlds meaning supervision and unix philosophy then have a look at runit and Void Linux which is a prominent user (void was started by an ex netbsd developer). Also full nix package manager support although I have yet to try it.
Re:What 'dependency' means in Unix init systems is underspec... by jjoonathan on Saturday October 27, 2018 @11:37PM (#18319056)
Could you expand on the details of how you expressed "after=network-online.target" and process supervision/restart using command ordering, &&, and ||?

EDIT: added supervision/restart