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

Ani Sinha ani at arista.com
Wed May 14 21:47:47 PDT 2014


On Wed, May 14, 2014 at 5:31 PM, Djalal Harouni <tixxdz at opendz.org> wrote:
> On Wed, May 14, 2014 at 03:12:55PM -0700, Ani Sinha 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.
> As Lennart have noted the:
> mount(NULL, "/", NULL, MS_SLAVE|MS_REC, NULL) is necessary for things
> to continue to work properly... is MS_SLAVE not an option ?
>
> Why pivot_root() fails ?

pivot_root() fails because of the following code in linux kernel :

http://lxr.free-electrons.com/source/fs/namespace.c#L2730

any code that calls pivot_root() under / will fail with EINVAL.

>
> I remember I've experienced something like this, I'm not sure if it's
> the same case, or if this will work for you:
>
> you could bind mount your new_root just before the pivot_root()

If configuring systemd not to mount root as shared is not an option,
we might have no choice but to investigate other options such as
these.

>
>
> --
> Djalal Harouni
> http://opendz.org


More information about the systemd-devel mailing list