[systemd-devel] remounting root fs outside containers as MS_SHARED

Lennart Poettering lennart at poettering.net
Thu May 15 03:25:35 PDT 2014


On Wed, 14.05.14 15:12, Ani Sinha (ani at arista.com) wrote:

> 
> On Wed, May 14, 2014 at 9:14 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Tue, 13.05.14 20:16, Ani Sinha (ani at arista.com) wrote:
> >
> 
> >
> > Why precisely would you want to disable propagation from the root dir?
> >
> 
> The core issue is that pivot_root() syscall breaks if the new_root is
> a mount point under / which is now shared. We use pivot_root() in our
> chroot code.
> 
> How do you propose softwares fix that?

Note that systemd itself can do pivot_root() for you. See "systemctl
switch-root". Isn't that enough for your needs?

If not, please have a look how it is implemented  in systemd:

http://cgit.freedesktop.org/systemd/systemd/tree/src/core/switch-root.c

This code temporarily switches back to MS_PRIVATE before the switch,
then the systemd invoked afterwards immediately switches back to
MS_SHARED again.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list