[Buildd-tools-devel] Bug#428805: Bug#428805: schroot: Fails to start a "directory" chroot

Raphael Hertzog hertzog at debian.org
Fri Jun 15 08:11:39 UTC 2007


Hi,

On Thu, 14 Jun 2007, Roger Leigh wrote:
> Regarding your other mail, we could indeed check whether the directory
> is mounted before mounting.  However, I'm not sure we can assume that
> the user doesn't want a filesystem mounting over the top of another
> (we don't know if they are the same or not).  This would be possible
> for real filesystems where we can stat the block device and mountpoint
> and compare the block-major and -minor numbers.  However, for procfs,
> devpts, tmpfs et. al., this is not really possible AFAICT--the device
> numbers are not easily accessible or can vary.  Do you have any
> thoughts here?

Another solution (that looks cleaner) is to use "mount --bind" rather
than "mount --rbind". That way, you don't keep the sub-mounts.

Extract from the mount man page:
----
Since Linux 2.4.0 it is possible to remount part of  the  file hierarchy
somewhere else. The call is
              mount --bind olddir newdir
After this call the same contents is accessible in two places.  One can
also remount a single file (on a single file).

This call attaches only (part of) a single filesystem, not possible
submounts.  The entire file hierarchy including submounts is attached a
second place using
              mount --rbind olddir newdir
-----

Currently you're using --rbind for "directory". You should probably use --rbind
for plain and --bind for directory.

Cheers,
-- 
Raphaël Hertzog

Premier livre français sur Debian GNU/Linux :
http://www.ouaza.com/livre/admin-debian/




More information about the Buildd-tools-devel mailing list