I've been reading the debates around systemd, haven't reached any firm
conclusion but the criticism that Unix programs should "do one thing
and do it well" certainly resonates with me.
On the other hand, this may be one of those cases where theory and
practice need to differ; more-or-less all the arguments against
systemd's complexity and overly broad scope have been used in debates
over monolithic vs. message-passing kernels. I'd say that in theory
message-passing and smaller programs are obviously better in some
ways, but in practice other considerations may be more important. That
is certainly the case for the kernel; I do not know if it is for
systemd.
All that said, I don't want to re-open the debate here. I would,
though, like to solicit comment on what seems to me a possible simple
alternative that deals with only one of the problems systemd claims to
solve; expressing dependencies that the init process needs to deal
with. There seems to be fairly widespread agreement that the way
sysvinit does this rather clumsy.
We already have a well-established way of dealing with some types of
dependency, in makefiles. Would something with roughly that syntax
work for expressing the dependencies here? Sample lines might be
things like:
sshd: random
!random:
cat /var/run/random_seed >/dev/urandom
The first line says sshd depends on random; "init sshd" will first
deal with dependencies, so it does the command for random before
starting sshd. Since no command is given for sshd, it defaults to
"sshd &". If arguments are needed, put in a command line. If some
other process depends on sshd it just checks whether it is running via
"ps -C sshd" and, if not, starts it.
"!random:" says, via the "!", that random is not a process that can be
checked with ps -C. We would need to add a data structure to support
another way to check if the process had been run. In actual use' we'd
also have a more complex command than just the cat.
It seems to me this could handle everything needed for init's startup
activities. Adding simple run levels is straightforward; just define
!runlevel3 or !network or whatever with appropriate dependencies. I am
not certain whether or how it might be extended to stop processes when
reducing run level, though.
Comments?
On 2014-10-17 11:53, Sandy Harris wrote:
> I've been reading the debates around systemd, haven't reached any firm
> conclusion but the criticism that Unix programs should "do one thing
> and do it well" certainly resonates with me.
>
> On the other hand, this may be one of those cases where theory and
> practice need to differ; more-or-less all the arguments against
> systemd's complexity and overly broad scope have been used in debates
> over monolithic vs. message-passing kernels. I'd say that in theory
> message-passing and smaller programs are obviously better in some
> ways, but in practice other considerations may be more important. That
> is certainly the case for the kernel; I do not know if it is for
> systemd.
>
> All that said, I don't want to re-open the debate here. I would,
> though, like to solicit comment on what seems to me a possible simple
> alternative that deals with only one of the problems systemd claims to
> solve; expressing dependencies that the init process needs to deal
> with. There seems to be fairly widespread agreement that the way
> sysvinit does this rather clumsy.
>
> We already have a well-established way of dealing with some types of
> dependency, in makefiles. Would something with roughly that syntax
> work for expressing the dependencies here? Sample lines might be
> things like:
>
> sshd: random
>
> !random:
> cat /var/run/random_seed >/dev/urandom
>
> The first line says sshd depends on random; "init sshd" will first
> deal with dependencies, so it does the command for random before
> starting sshd. Since no command is given for sshd, it defaults to
> "sshd &". If arguments are needed, put in a command line. If some
> other process depends on sshd it just checks whether it is running via
> "ps -C sshd" and, if not, starts it.
>
> "!random:" says, via the "!", that random is not a process that can be
> checked with ps -C. We would need to add a data structure to support
> another way to check if the process had been run. In actual use' we'd
> also have a more complex command than just the cat.
>
> It seems to me this could handle everything needed for init's startup
> activities. Adding simple run levels is straightforward; just define
> !runlevel3 or !network or whatever with appropriate dependencies. I am
> not certain whether or how it might be extended to stop processes when
> reducing run level, though.
>
> Comments?
Actually, Gentoo's OpenRC init system uses make for dependency
processing already, but only when configured for parallel startup. It
would be nice if it were better integrated (OpenRC generates (and then
caches) the Makefile each time one of the initscripts or runlevels gets
modified).
To be honest though, systemd's developers seem to ignore the fact that
there are many other init systems that have better dependency processing
than sysvinit and/or can do parallel startup. The only thing that I can
see in systemd that isn't available in some other init system is socket
activation, and even that isn't exclusive anymore with the advent of
uselessd.