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

Mantas Mikulėnas grawity at gmail.com
Tue May 14 08:22:04 UTC 2019


On Tue, May 14, 2019 at 10:24 AM Ulrich Windl <
Ulrich.Windl at rz.uni-regensburg.de> wrote:

> >>> Andrei Borzenkov <arvidjaar at gmail.com> schrieb am 14.05.2019 um 08:40
> in
> Nachricht
> <CAA91j0VyN+972Q+D8b5YO1s04JM0BuxcHz_HN8fq9=-H616rXQ at mail.gmail.com>:
> > On Tue, May 14, 2019 at 9:35 AM Ulrich Windl
> > <Ulrich.Windl at rz.uni-regensburg.de> wrote:
> >
> >>
> >> I knew that. It doesn't answer _why_ /var/run is obsolete.
> >>
> >
> > /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.
> 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?
>

1. systemd performs these actions during initialization, before switching
to the main loop.
2. systemd can operate without any sockets; it connects to D-Bus for
control once it becomes available, but it's not a runtime requirement.


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

The 'systemd-shutdown' binary doesn't unmount /run or /, it keeps the
former and remounts the latter read-only.

(It can optionally pivot_root *to* /run, though, and unmount / using the
"shutdown initramfs" feature.)


>
> 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, it is reversed on shutdown.


>
> From the experience how fast shutdown happens, I don't think it's like
> that.
>

Usually killing processes is faster than loading them from disk.

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20190514/501c7deb/attachment-0001.html>


More information about the systemd-devel mailing list