tags 428805 + patch
thanks

Raphael Hertzog <[EMAIL PROTECTED]> writes:

> Another solution (that looks cleaner) is to use "mount --bind" rather
> than "mount --rbind". That way, you don't keep the sub-mounts.
[...]
> Currently you're using --rbind for "directory". You should probably
> use --rbind for plain and --bind for directory.

Agreed.  This does look much cleaner, and also fits in with the
difference between the two options.

Does the attached patch for the 10mount script fix things for you?


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.
Index: bin/schroot/setup/10mount
===================================================================
--- bin/schroot/setup/10mount	(revision 1220)
+++ bin/schroot/setup/10mount	(working copy)
@@ -62,12 +62,14 @@
 
 if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
 
-    if [ "$CHROOT_TYPE" = "plain" ] || [ "$CHROOT_TYPE" = "directory" ]; then
+    if [ "$CHROOT_TYPE" = "plain" ]; then
 	CHROOT_MOUNT_OPTIONS="--rbind"
 	CHROOT_MOUNT_DEVICE="$CHROOT_LOCATION"
-    fi
-
-    if [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+    elif [ "$CHROOT_TYPE" = "directory" ]; then
+	CHROOT_MOUNT_OPTIONS="--bind"
+	CHROOT_MOUNT_DEVICE="$CHROOT_LOCATION"
+    elif [ "$CHROOT_TYPE" = "lvm-snapshot" ]; then
+	CHROOT_MOUNT_OPTIONS=""
 	CHROOT_MOUNT_DEVICE="$CHROOT_LVM_SNAPSHOT_DEVICE"
     fi
 
Index: bin/schroot/schroot.conf.5.in
===================================================================
--- bin/schroot/schroot.conf.5.in	(revision 1220)
+++ bin/schroot/schroot.conf.5.in	(working copy)
@@ -136,14 +136,23 @@
 .PP
 Chroots of type \[oq]plain\[cq] or \[oq]directory\[cq] are directories
 accessible in the filesystem.  The two types are equivalent except for the fact
-that if \f[CI]run-setup-scripts\fP is set to \[oq]true\[cq] for \[oq]plain\[cq]
-chroots, filesystem mounting is disabled.  They have an additional (mandatory)
-configuration option:
+that if \f[CI]run\-setup\-scripts\fP is set to \[oq]true\[cq] for
+\[oq]plain\[cq] chroots, filesystem mounting is disabled.
+.PP
+These chroot types have an additional (mandatory) configuration option:
 .TP
 \f[CBI]location=\fP\f[CI]directory\fP
+
 The directory containing the chroot environment.  This is where the root will
 be changed to when executing a login shell or a command.  The directory must
-exist and have read and execute permissions to allow users access to it.
+exist and have read and execute permissions to allow users access to it.  Note
+that on Linux systems it will be bind-mounted elsewhere for use as a chroot;
+the directory for \[oq]plain\[cq] chroots is mounted with the \fI\-\-rbind\fP
+option to
+.BR mount (8),
+while for \[oq]directory\[cq] chroots \fI\-\-bind\fP is used instead so that
+sub-mounts are not preserved.
+
 .SS
 File chroots
 .PP
@@ -169,9 +178,10 @@
 This is the device name of the block device, including the absolute path.  For
 example, \[lq]/dev/sda5\[rq].
 .TP
-\f[CBI]mount-options=\fP\f[CI]mount_options\fP
-Mount options for the block device.  These are additional options to pass to
-mount(8).  For example, \[lq]\-o atime,sync,user_xattr\[rq].
+\f[CBI]mount-options=\fP\f[CI]mount_options\fP Mount options for the block
+device.  These are additional options to pass to
+.BR mount (8).
+For example, \[lq]\-o atime,sync,user_xattr\[rq].
 .TP
 \f[CBI]location=\fP\f[CI]path\fP
 This is the path to the chroot \fIinside\fP the filesystem on the device.  For
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 1220)
+++ debian/changelog	(working copy)
@@ -1,8 +1,13 @@
 schroot (1.1.5-1) UNRELEASED; urgency=low
 
   * New upstream development release.
+  * bin/schroot/setup/10mount: Use --bind rather than --rbind for
+    directory chroots.  This allows filesystem mounting to succeed when
+    sub-mounts are already mounted on top of the original directory
+    (Closes: #428805).  Thanks to Raphaël Hertzog for diagnosing this
+    problem.
 
- -- Roger Leigh <[EMAIL PROTECTED]>  Mon, 28 May 2007 22:31:38 +0100
+ -- Roger Leigh <[EMAIL PROTECTED]>  Sun, 17 Jun 2007 10:23:04 +0100
 
 schroot (1.1.4-1) unstable; urgency=low
 
Index: THANKS
===================================================================
--- THANKS	(revision 1220)
+++ THANKS	(working copy)
@@ -2,18 +2,19 @@
 It would not be what it is today without the invaluable help of these
 people:
 
-Andreas Bombe <[EMAIL PROTECTED]>
-Steve Langasek <[EMAIL PROTECTED]>
-Martin Michlmayr <[EMAIL PROTECTED]>
-Lucas Nussbaum <[EMAIL PROTECTED]>
-Adeodato Simó <[EMAIL PROTECTED]>
+Andreas Bombe		<[EMAIL PROTECTED]>
+Raphaël Hertzog		<[EMAIL PROTECTED]>
+Steve Langasek		<[EMAIL PROTECTED]>
+Martin Michlmayr	<[EMAIL PROTECTED]>
+Lucas Nussbaum		<[EMAIL PROTECTED]>
+Adeodato Simó		<[EMAIL PROTECTED]>
 	For many suggestions, feature requests and bug reports.
 	Without their destruction testing and help, schroot would not
 	have been pushed as far as it has.
 
-Ben Hutchings <[EMAIL PROTECTED]>
+Ben Hutchings		<[EMAIL PROTECTED]>
 	Help with many C++ problems, especially the intricacies of
 	templates and other obscure and annoying language features.
 
-Simon Richter <[EMAIL PROTECTED]>
+Simon Richter		<[EMAIL PROTECTED]>
 	Help with PAM session handling.
\ No newline at end of file
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1220)
+++ ChangeLog	(working copy)
@@ -1,3 +1,15 @@
+2007-06-17  Roger Leigh  <[EMAIL PROTECTED]>
+
+	* THANKS: Add Raphaël Hertzog.
+
+	* debian/changelog: Close #428805.
+
+	* bin/schroot/schroot.conf.5.in: Document use of --bind and
+	--rbind for plain and directory chroots.
+
+	* bin/schroot/setup/10mount: Use --bind rather than --rbind for
+	directory chroots.
+
 2007-05-28  Roger Leigh  <[EMAIL PROTECTED]>
 
 	* debian/changelog: Bump version to 1.1.5.

Attachment: pgprJ4OEg2S7u.pgp
Description: PGP signature

Reply via email to