[systemd-devel] Questions about systemd's "root storage daemon" concept

Lennart Poettering lennart at poettering.net
Thu Jan 28 14:11:08 UTC 2021


On Do, 28.01.21 10:08, Martin Wilck (mwilck at suse.com) wrote:

> Hi Lennart,
>
> thanks again.
>
> On Wed, 2021-01-27 at 23:56 +0100, Lennart Poettering wrote:
> > On Mi, 27.01.21 21:51, Martin Wilck (mwilck at suse.com) wrote:
> >
> > if you want the initrd environment to fully continue to exist,
>
> I don't. I just need /sys and /dev (and perhaps /proc and /run, too) to
> remain accessible. I believe most root storage daemons will need this.
>
> > consider creating a new mount namespace, bind mount the initrd root
> > into it recursively to some new dir you created. Then afterwards mark
> > that mount MS_PRIVATE. then pivot_root()+chroot()+chdir() into your
> > new old world.
>
> And on exit, I'd need to tear all that down again, right? I don't want
> my daemon to block shutdown because some file systems haven't been
> cleanly unmounted.

if you don't need the initrd root, i.e. don't intend to open any
further files, then you can just mount a an empty tmpfs to your
tempdir, mount proc/sys into it, then transition your process into it
and forget about the rest.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list