bug in `mount --bind` when using nested mounts

Rob Landley rob at landley.net
Fri Feb 3 23:22:14 UTC 2006


On Thursday 02 February 2006 21:20, Mike Frysinger wrote:
> not sure if you're aware of this issue Rob, but i just noticed it today ...

I'm aware of something like 7 issues with the current mount.  Let's see what 
this is...

> i bind mount a lot with chroots, so i tend to have scripts setup which
> check to see if the chroot has certain dirs bind mounted already and if
> not, to set them up before chrooting ...
>
> for example, i have /dev setup as a tmpfs with mdev and /dev/pts mounted as
> a devpts filesystem:
> $ mount | grep /dev
> devpts /dev/pts devpts rw 0 0
> mdev /dev tmpfs rw,nosuid 0 0
>
> then in my script i do:
> d=/mnt/chroot
> for m in dev dev/pts ; do
>  grep -sq $d/$m /proc/mounts || mount --bind /$m $d/$m
> done
> exec chroot $d /bin/bash
>
> with current svn busybox trunk, it seems /dev is mounted twice
> at /mnt/chroot/dev and /mnt/chroot/dev/pts instead of /dev at
> /mnt/chroot/dev and /dev/pts at /mnt/chroot/dev/pts

Hmmm...  This might be that mount --bind and mount --move need to be treated 
like -o,remount.  I'll try to reproduce this when I get all the scattered 
bits of mount to fit back in the box again (possibly this evening, more 
likely tomorrow).

> -mike
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox

-- 
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.



More information about the busybox mailing list