mkinitrd unification across distributions
 help / color / mirror / Atom feed
* Re: [PATCH] switch_root: a better approach to subroots
       [not found] ` <20091118153312.16E989D404F-k/4jFdqg8LLlyo9zxV8I99HuzzzSOjJt@public.gmane.org>
@ 2009-11-18 18:47   ` Karel Zak
       [not found]     ` <20091118184706.GB23977-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
  2009-11-20 14:30   ` Karel Zak
  1 sibling, 1 reply; 5+ messages in thread
From: Karel Zak @ 2009-11-18 18:47 UTC (permalink / raw)
  To: Daniel Drake
  Cc: util-linux-ng-u79uwXL29TY76Z2rM5mHXA, Peter Jones,
	initramfs-u79uwXL29TY76Z2rM5mHXA, Harald Hoyer


 I think dracut guys should be in CC. Any objection against this change? 
 
On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> This reverts commit a692a8745941a192528c5e2a05de97155ba586f9.
> Booting into a system this way just leads to problems because
> you cannot remount the root read-only at shutdown (leading to unclean
> shutdowns).
> 
> Miklos Szeredi pointed out a trick to turn any directory into a
> mount point which avoids this problem. Therefore we can simplify
> switch_root again and simply document that its users should set
> up the root as a mount point beforehand.
> ---
>  sys-utils/switch_root.8 |   13 +++++++
>  sys-utils/switch_root.c |   81 +++--------------------------------------------
>  2 files changed, 18 insertions(+), 76 deletions(-)
> 
> diff --git a/sys-utils/switch_root.8 b/sys-utils/switch_root.8
> index 4fdc8e9..b6712ec 100644
> --- a/sys-utils/switch_root.8
> +++ b/sys-utils/switch_root.8
> @@ -32,6 +32,19 @@ show version number and exit
>  .B switch_root
>  returns 0 on success and 1 on failure.
>  
> +.SH NOTES
> +switch_root will fail to function if
> +.B newroot
> +is not the root of a mount. If you want to switch root into a directory that
> +does not meet this requirement then you can first use a bind-mounting trick to
> +turn any directory into a mount point:
> +.sp
> +.nf
> +.RS
> +mount --bind $DIR $DIR

 Cannot we add this functionality directly to the switch_root command?
 I mean call:

    mount --bind /newroot/subroot /newroot/subroot 
    mount --move /newroot/subroot /

 Now we have:

    mount --move newroot /
    chroot /newroot/subroot


    Karel

-- 
 Karel Zak  <kzak-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] switch_root: a better approach to subroots
       [not found]     ` <20091118184706.GB23977-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
@ 2009-11-18 20:13       ` Peter Jones
       [not found]         ` <4B045586.1090906-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2009-11-20 14:05       ` Victor Lowther
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Jones @ 2009-11-18 20:13 UTC (permalink / raw)
  To: Karel Zak
  Cc: Daniel Drake, util-linux-ng-u79uwXL29TY76Z2rM5mHXA,
	initramfs-u79uwXL29TY76Z2rM5mHXA, Harald Hoyer

On 11/18/2009 01:47 PM, Karel Zak wrote:
> 
>  I think dracut guys should be in CC. Any objection against this change? 
>  
> On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
>> This reverts commit a692a8745941a192528c5e2a05de97155ba586f9.
>> Booting into a system this way just leads to problems because
>> you cannot remount the root read-only at shutdown (leading to unclean
>> shutdowns).
>>
>> Miklos Szeredi pointed out a trick to turn any directory into a
>> mount point which avoids this problem. Therefore we can simplify
>> switch_root again and simply document that its users should set
>> up the root as a mount point beforehand.
>> ---
>>  sys-utils/switch_root.8 |   13 +++++++
>>  sys-utils/switch_root.c |   81 +++--------------------------------------------
>>  2 files changed, 18 insertions(+), 76 deletions(-)
>>
>> diff --git a/sys-utils/switch_root.8 b/sys-utils/switch_root.8
>> index 4fdc8e9..b6712ec 100644
>> --- a/sys-utils/switch_root.8
>> +++ b/sys-utils/switch_root.8
>> @@ -32,6 +32,19 @@ show version number and exit
>>  .B switch_root
>>  returns 0 on success and 1 on failure.
>>  
>> +.SH NOTES
>> +switch_root will fail to function if
>> +.B newroot
>> +is not the root of a mount. If you want to switch root into a directory that
>> +does not meet this requirement then you can first use a bind-mounting trick to
>> +turn any directory into a mount point:
>> +.sp
>> +.nf
>> +.RS
>> +mount --bind $DIR $DIR
> 
>  Cannot we add this functionality directly to the switch_root command?
>  I mean call:
> 
>     mount --bind /newroot/subroot /newroot/subroot 
>     mount --move /newroot/subroot /
> 
>  Now we have:
> 
>     mount --move newroot /
>     chroot /newroot/subroot

That certainly seems preferable to reverting the patch, especially if, as
the original commit log says, some distro (OLPC in this case) is actually
using this functionality.

-- 
        Peter

Any connection between your reality and mine is purely coincidental.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] switch_root: a better approach to subroots
       [not found]         ` <4B045586.1090906-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2009-11-19  8:19           ` Harald Hoyer
  0 siblings, 0 replies; 5+ messages in thread
From: Harald Hoyer @ 2009-11-19  8:19 UTC (permalink / raw)
  To: Peter Jones
  Cc: Karel Zak, Daniel Drake, util-linux-ng-u79uwXL29TY76Z2rM5mHXA,
	initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/18/2009 09:13 PM, Peter Jones wrote:
> On 11/18/2009 01:47 PM, Karel Zak wrote:
>>
>>   I think dracut guys should be in CC. Any objection against this change?
>>
>> On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
>>> This reverts commit a692a8745941a192528c5e2a05de97155ba586f9.
>>> Booting into a system this way just leads to problems because
>>> you cannot remount the root read-only at shutdown (leading to unclean
>>> shutdowns).
>>>
>>> Miklos Szeredi pointed out a trick to turn any directory into a
>>> mount point which avoids this problem. Therefore we can simplify
>>> switch_root again and simply document that its users should set
>>> up the root as a mount point beforehand.
>>> ---
>>>   sys-utils/switch_root.8 |   13 +++++++
>>>   sys-utils/switch_root.c |   81 +++--------------------------------------------
>>>   2 files changed, 18 insertions(+), 76 deletions(-)
>>>
>>> diff --git a/sys-utils/switch_root.8 b/sys-utils/switch_root.8
>>> index 4fdc8e9..b6712ec 100644
>>> --- a/sys-utils/switch_root.8
>>> +++ b/sys-utils/switch_root.8
>>> @@ -32,6 +32,19 @@ show version number and exit
>>>   .B switch_root
>>>   returns 0 on success and 1 on failure.
>>>
>>> +.SH NOTES
>>> +switch_root will fail to function if
>>> +.B newroot
>>> +is not the root of a mount. If you want to switch root into a directory that
>>> +does not meet this requirement then you can first use a bind-mounting trick to
>>> +turn any directory into a mount point:
>>> +.sp
>>> +.nf
>>> +.RS
>>> +mount --bind $DIR $DIR
>>
>>   Cannot we add this functionality directly to the switch_root command?
>>   I mean call:
>>
>>      mount --bind /newroot/subroot /newroot/subroot
>>      mount --move /newroot/subroot /
>>
>>   Now we have:
>>
>>      mount --move newroot /
>>      chroot /newroot/subroot
>
> That certainly seems preferable to reverting the patch, especially if, as
> the original commit log says, some distro (OLPC in this case) is actually
> using this functionality.
>

no objections
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] switch_root: a better approach to subroots
       [not found]     ` <20091118184706.GB23977-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
  2009-11-18 20:13       ` Peter Jones
@ 2009-11-20 14:05       ` Victor Lowther
  1 sibling, 0 replies; 5+ messages in thread
From: Victor Lowther @ 2009-11-20 14:05 UTC (permalink / raw)
  To: Karel Zak
  Cc: Daniel Drake, util-linux-ng-u79uwXL29TY76Z2rM5mHXA, Peter Jones,
	initramfs-u79uwXL29TY76Z2rM5mHXA, Harald Hoyer

On Wed, 2009-11-18 at 19:47 +0100, Karel Zak wrote:
> I think dracut guys should be in CC. Any objection against this change? 
>  
> On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> > This reverts commit a692a8745941a192528c5e2a05de97155ba586f9.
> > Booting into a system this way just leads to problems because
> > you cannot remount the root read-only at shutdown (leading to unclean
> > shutdowns).
> > 
> > Miklos Szeredi pointed out a trick to turn any directory into a
> > mount point which avoids this problem. Therefore we can simplify
> > switch_root again and simply document that its users should set
> > up the root as a mount point beforehand.
> > ---
> >  sys-utils/switch_root.8 |   13 +++++++
> >  sys-utils/switch_root.c |   81 +++--------------------------------------------
> >  2 files changed, 18 insertions(+), 76 deletions(-)
> > 
> > diff --git a/sys-utils/switch_root.8 b/sys-utils/switch_root.8
> > index 4fdc8e9..b6712ec 100644
> > --- a/sys-utils/switch_root.8
> > +++ b/sys-utils/switch_root.8
> > @@ -32,6 +32,19 @@ show version number and exit
> >  .B switch_root
> >  returns 0 on success and 1 on failure.
> >  
> > +.SH NOTES
> > +switch_root will fail to function if
> > +.B newroot
> > +is not the root of a mount. If you want to switch root into a directory that
> > +does not meet this requirement then you can first use a bind-mounting trick to
> > +turn any directory into a mount point:
> > +.sp
> > +.nf
> > +.RS
> > +mount --bind $DIR $DIR
> 
>  Cannot we add this functionality directly to the switch_root command?
>  I mean call:
> 
>     mount --bind /newroot/subroot /newroot/subroot 
>     mount --move /newroot/subroot /
> 
>  Now we have:
> 
>     mount --move newroot /
>     chroot /newroot/subroot

Sounds like a good idea, even if it is not a common case.  I am fine
with it.

> 
>     Karel
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] switch_root: a better approach to subroots
       [not found] ` <20091118153312.16E989D404F-k/4jFdqg8LLlyo9zxV8I99HuzzzSOjJt@public.gmane.org>
  2009-11-18 18:47   ` [PATCH] switch_root: a better approach to subroots Karel Zak
@ 2009-11-20 14:30   ` Karel Zak
  1 sibling, 0 replies; 5+ messages in thread
From: Karel Zak @ 2009-11-20 14:30 UTC (permalink / raw)
  To: Daniel Drake, Peter Jones
  Cc: util-linux-ng-u79uwXL29TY76Z2rM5mHXA,
	initramfs-u79uwXL29TY76Z2rM5mHXA, Harald Hoyer

On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> This reverts commit a692a8745941a192528c5e2a05de97155ba586f9.

 Revered and man page updated. switch_root does not support subroots
 from now.

On Wed, Nov 18, 2009 at 03:13:58PM -0500, Peter Jones wrote:
> On 11/18/2009 01:47 PM, Karel Zak wrote:
> > On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> >> +.SH NOTES
> >> +switch_root will fail to function if
> >> +.B newroot
> >> +is not the root of a mount. If you want to switch root into a directory that
> >> +does not meet this requirement then you can first use a bind-mounting trick to
> >> +turn any directory into a mount point:
> >> +.sp
> >> +.nf
> >> +.RS
> >> +mount --bind $DIR $DIR
> > 
> >  Cannot we add this functionality directly to the switch_root command?
> >  I mean call:
> > 
> >     mount --bind /newroot/subroot /newroot/subroot 
> >     mount --move /newroot/subroot /
> > 
> >  Now we have:
> > 
> >     mount --move newroot /
> >     chroot /newroot/subroot
> 
> That certainly seems preferable to reverting the patch, especially if, as

 I agree. People (IMHO OLPC project only) who need subroots can easily
 add "mount --bind" to their initrd. 

    Karel


-- 
 Karel Zak  <kzak-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-20 14:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20091118153312.16E989D404F@zog.reactivated.net>
     [not found] ` <20091118153312.16E989D404F-k/4jFdqg8LLlyo9zxV8I99HuzzzSOjJt@public.gmane.org>
2009-11-18 18:47   ` [PATCH] switch_root: a better approach to subroots Karel Zak
     [not found]     ` <20091118184706.GB23977-sHeGUpI7y9L/9pzu0YdTqQ@public.gmane.org>
2009-11-18 20:13       ` Peter Jones
     [not found]         ` <4B045586.1090906-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2009-11-19  8:19           ` Harald Hoyer
2009-11-20 14:05       ` Victor Lowther
2009-11-20 14:30   ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox