[Pkg-sysvinit-devel] Systemd, best parts

Petter Reinholdtsen pere at hungry.com
Mon Oct 24 17:02:15 UTC 2011


[Sergey]
> I wanted to share some init-related ideas with some smart people, and
> could not find a better place for them than this list.

Interesting ideas.

> Both these ideas (with a lot of others) are implemented by systemd. But
> without systemd these ideas themselves don't break any compatibility.
> And I believe they can (and should) be implemented in two separate small
> parts.
> 
> For example part #2 may be implemented with the following approach:
> * find the part of init scripts that parses /etc/fstab, checks and
>   mounts filesystems
> * rewrite it in C as a separate program (let's call it `initmountd`)
>   which does exactly same things but in C
> * then change that `initmountd` in the way that it puts autofs
>   mountpoints on all directories that are not marked as "noauto" and
>   then goes background and continues to check/mount filesystems in
>   background
> That's all. One new program and a few init scripts changed. No new
> configurations needed, nothing is broken, it's backward and forward
> compatible, meaning that for systems that don't have autofs support
> initmountd just won't go background and everything will be the same.

This sound like it could work.  I would be happy to test it if someone
have time to implement it. :)

> Part #1 is not that short to explain, but its idea is the same. If we
> want to track dependencies between services with their sockets then...
> let's track it. That's what LSB Header is for. The only change is that
> socket must be explicitly shown there. So instead of:
>   # Provides:          mysql
> there would be:
>   # Provides:          mysql
>   # Provides:          unix:/var/lib/mysql/mysql.sock
>   # Provides:          tcp:mysql
> These sockets would be created by init daemon and passed to mysqld
> on startup. And if another service have something like:
>   # Required-Start:    unix:/var/lib/mysql/mysql.sock
> it can be started in parallel to mysql server.
> That's _almost_ all. An extension to LSB header and a patch to init
> daemon for support of this extension and init-based sockets creation is
> all that needed for the part #1. And again everything is backward and
> forward compatible.

How should this socket passing work when init start a shell script which
in turn start a daemon that should receive the socket?  I fail to
understand how it could be done.

> Some people like systemd units because they're short. That feature can
> also be implemented using existing scripts as another separate
> mini-feature with something like this:
>   #!/bin/sh
>   ### BEGIN INIT INFO
>   # Provides:             sshd
>   # Required-Start:       $remote_fs $syslog
>   # Required-Stop:        $remote_fs $syslog
>   ### END INIT INFO
>   ExecStart="/usr/sbin/sshd -D"
>   source /etc/default/initscript-shortcut
> It still makes everything backward compatible, and allows those who
> want a great flexibility to write bash scripts, while allowing others
> to use a shortcut /etc/default/initscript-shortcut which would
> implement the rest for them.

I would love to see something like this for the simple cases, and even
started on such implementation but never had time to get it working.
Note that the include file should be outside /etc/ (it is not a
configuration file) to allow easy upgrades.

> What do you think? Is it right/wrong? Would debian accept such change
> if it's actually implemented?

I am all for backwards compatible improvements to the boot system, so
patches would definitely be well received.  But I can of course not
promise that anything would be accepted before it is available for
testing. :)
-- 
Happy hacking
Petter Reinholdtsen



More information about the Pkg-sysvinit-devel mailing list