Richard W.M. Jones
2016-Mar-24 10:48 UTC
[Libguestfs] [PATCH 1/2] rescue: Suggest using recursive bind mounts.
Since /dev and other directories contain sub-mounts, suggest using --rbind instead of --bind. This also allows us to remove the /dev/pts line. --- rescue/rescue.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rescue/rescue.c b/rescue/rescue.c index 53afdae..9a7c988 100644 --- a/rescue/rescue.c +++ b/rescue/rescue.c @@ -453,10 +453,9 @@ do_suggestion (struct drv *drvs) /* If it's Linux, print the bind-mounts. */ if (type && STREQ (type, "linux")) { - printf ("mount --bind /dev /sysroot/dev\n"); - printf ("mount --bind /dev/pts /sysroot/dev/pts\n"); - printf ("mount --bind /proc /sysroot/proc\n"); - printf ("mount --bind /sys /sysroot/sys\n"); + printf ("mount --rbind /dev /sysroot/dev\n"); + printf ("mount --rbind /proc /sysroot/proc\n"); + printf ("mount --rbind /sys /sysroot/sys\n"); } printf ("\n"); -- 2.7.4
Richard W.M. Jones
2016-Mar-24 10:48 UTC
[Libguestfs] [PATCH 2/2] rescue: Print chroot suggestion for Linux guests.
--- rescue/rescue.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rescue/rescue.c b/rescue/rescue.c index 9a7c988..8180ba0 100644 --- a/rescue/rescue.c +++ b/rescue/rescue.c @@ -451,11 +451,14 @@ do_suggestion (struct drv *drvs) for (j = 0; mps[j] != NULL; j += 2) printf ("mount %s /sysroot%s\n", mps[j+1], mps[j]); - /* If it's Linux, print the bind-mounts. */ + /* If it's Linux, print the bind-mounts and a chroot command. */ if (type && STREQ (type, "linux")) { printf ("mount --rbind /dev /sysroot/dev\n"); printf ("mount --rbind /proc /sysroot/proc\n"); printf ("mount --rbind /sys /sysroot/sys\n"); + printf ("\n"); + printf ("cd /sysroot\n"); + printf ("chroot /sysroot\n"); } printf ("\n"); -- 2.7.4
Reasonably Related Threads
- Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
- [PATCH] rescue: add --autosysroot option RHBZ#1183493
- [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
- [PATCH v2] rescue: add --autosysroot option RHBZ#1183493
- Re: [PATCH v2] rescue: add --autosysroot option RHBZ#1183493