[systemd-devel] The first and the last things in systemd's lifecycle

Lennart Poettering lennart at poettering.net
Tue May 14 08:51:20 UTC 2019


On Di, 14.05.19 09:23, Ulrich Windl (Ulrich.Windl at rz.uni-regensburg.de) wrote:

> > /var/run needs /var which is not guaranteed to be there when you need
> > it which complicates things.
>
> Thanks,
>
> I'll start a new thread on this (I wanted to ask anyway):
> AFAIK systemd does socket communication a lot, while old init was
> happy with just a root filesystem.

sysvinit communicated via a fifo in the file system. This isn't too
different, except maybe it's one way and single-connection while
sockets are duplex and can have parallel connections generally.

> So I wonder how this Hen-Egg_Problem is solved: Systemd needs a
> socket to operate, but to provide the infrastructure, systemd would
> need the socket do do so.  Or expressed in other words: How can
> systemd create /run when it needs /run to operate?

systemd mounts /run early on if its not mounted yet, becore creating
any sockets in it.

> The corresponding question would be for shutdown: How will systemd
> unmount /run? OK, if ist a ramdisk, it's not really needed.

It closes all sockets, then unmounts it. /run has to be a tmpfs, so
yes, it's backed by pageable memory.

> Another related question is that of shutdown in general:
>
> For startup the semantics of Before= and After= are clear, but isn't
> it just reverted for shutdown? That is if "M" has "After=X" and
> "Before=Y", does that imply that Y is stopped before M will be
> stzopped, and M will be stopped before X is?

Yes, the order between two ordered units is reversed if both are
stopped. THat's how that is implemented.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list