switch_root: a better approach to subroots
I think dracut guys should be in CC. Any objection against this change?
Quoted 22 lines · Daniel Drake
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_rootagain 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(-)sys-utils/switch_root.8 +0
-0@@ -32,6 +32,19 @@ show version number and exit .B switch_root returns 0 on success and 1 on failure.
sys-utils/switch_root.8 show version number and exit · line 44
Quoted 10 lines
sys-utils/switch_root.8 +10
-0+.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
KarelSignature · 1 line
Karel Zak <[email protected]>
Quoted 40 lines · Karel Zak
I think dracut guys should be in CC. Any objection against this change?
Quoted 22 lines · Daniel Drake
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_rootagain 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(-)sys-utils/switch_root.8 +0
-0@@ -32,6 +32,19 @@ show version number and exit .B switch_root returns 0 on success and 1 on failure.sys-utils/switch_root.8 show version number and exit · line 44
Quoted 10 lines
sys-utils/switch_root.8 +10
-0+.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 $DIRCannot we add this functionality directly to the
switch_rootcommand? I mean call:
Quoted 7 lines
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.
Signature · 3 lines
Peter Any connection between your reality and mine is purely coincidental.
Quoted 44 lines · Peter Jones
Quoted 43 lines · Karel Zak
I think dracut guys should be in CC. Any objection against this change?
Quoted 22 lines · Daniel Drake
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_rootagain 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(-)sys-utils/switch_root.8 +0
-0@@ -32,6 +32,19 @@ show version number and exit .B switch_root returns 0 on success and 1 on failure.sys-utils/switch_root.8 show version number and exit · line 44
Quoted 10 lines
sys-utils/switch_root.8 +10
-0+.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 $DIRCannot we add this functionality directly to the
switch_rootcommand? I mean call:mount --bind /newroot/subroot /newroot/subroot mount --move /newroot/subroot /
Quoted 9 lines
Quoted 4 lines
Now we have:
mount --move newroot / chroot /newroot/subrootThat 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 39 lines · Karel Zak
I think dracut guys should be in CC. Any objection against this change?
Quoted 22 lines · Daniel Drake
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_rootagain 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(-)sys-utils/switch_root.8 +0
-0@@ -32,6 +32,19 @@ show version number and exit .B switch_root returns 0 on success and 1 on failure.sys-utils/switch_root.8 show version number and exit · line 44
Quoted 10 lines
sys-utils/switch_root.8 +10
-0+.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 $DIRCannot we add this functionality directly to the
switch_rootcommand? I mean call:
Quoted 7 lines
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.
Quoted 3 lines
Karel
Quoted 1 line · Daniel Drake
This reverts commit
a692a8745941a192528c5e2a05de97155ba586f9.
Revered and man page updated. switch_root does not support subroots from now.
Quoted 19 lines · Peter Jones
Quoted 18 lines · Karel Zak
Review
Quoted 10 lines · Daniel Drake
+.SH NOTES
(quoted diff) +9
-0+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 $DIRCannot we add this functionality directly to the
switch_rootcommand? I mean call:mount --bind /newroot/subroot /newroot/subroot mount --move /newroot/subroot /
Quoted 6 lines
Quoted 4 lines
Now we have:
mount --move newroot / chroot /newroot/subrootThat 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
Signature · 5 lines
Karel Zak <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html