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

2019-05-14 Thread Lennart Poettering
On Di, 14.05.19 09:23, Ulrich Windl (ulrich.wi...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

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

2019-05-14 Thread Mantas Mikulėnas
On Tue, May 14, 2019 at 10:24 AM Ulrich Windl <
ulrich.wi...@rz.uni-regensburg.de> wrote:

> >>> Andrei Borzenkov  schrieb am 14.05.2019 um 08:40
> in
> Nachricht
> :
> > On Tue, May 14, 2019 at 9:35 AM Ulrich Windl
> >  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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

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

2019-05-14 Thread Ulrich Windl
>>> Andrei Borzenkov  schrieb am 14.05.2019 um 08:40 in
Nachricht
:
> On Tue, May 14, 2019 at 9:35 AM Ulrich Windl
>  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?
The corresponding question would be for shutdown: How will systemd unmount 
/run? OK, if ist a ramdisk, it's not really needed.

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?

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

Regards,
Ulrich



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel