Mounting multiple loop-devices via BB
Rob Landley
rob at landley.net
Tue May 9 22:04:11 UTC 2006
On Tuesday 09 May 2006 3:44 pm, Alexander 'E-Razor' Krause wrote:
> > My kernel isn't patched with unionfs, so I can't replicate that. I'm
> > guessing your $DYNAMIC is a writeable block device?
>
> Indeed, it's /dev/hda2 mounted rw.
Ok.
> > Well, first of all, does your new directory have /proc mounted, or
> > an /etc/filesystems that mentions squashfs? If not it won't be able to
> > do automatic filesystem type detection, and I don't think I have a
> > specific error message for that.
>
> Bot root's do have /proc mounted.
> There is no /etc/filesystems but i don't think that'd be necessary cos of
> proc.
If you have /proc, life is good.
> > My first guess would be that you haven't got /proc after the chroot, or
> > an /etc/filesystems, so when you don't specify a filesystem type it
> > doesn't know what names to try, and it's not giving a very informative
> > error message. But that's just a guess.
>
> Geode /mnt/stage1 $ mount | grep proc
> /proc on /mnt/stage1/proc type proc (rw)
> none on /proc type proc (rw)
> The /mnt/stage1 is my old root as you can see in the script.
>
> > Did you build with legacy mtab support? (Random question, shouldn't
> > affect this, just curious.)
>
> I enabled CONFIG_FEATURE_MTAB_SUPPORT on both BB's (the one in stage1 and
> the one in static).
Why would you do that when you have /proc? After the chroot your
old /etc/mtab is left behind and thus it isn't aware of any existing mounts,
although that shouldn't affect this particular case. But in general, if you
have /proc you shouldn't need MTAB_SUPPORT...
> > There's a couple of other possibilities:
> >
> > 1) It couldn't find or access /dev/loop* (permissions?)
>
> I think the permissions are all right.
> Geode /mnt/stage1 $ stat -c "%N %a (%A)
>
> > " /dev/loop*
>
> /dev/loop0 660 (brw-rw----)
> /dev/loop1 660 (brw-rw----)
> /dev/loop2 660 (brw-rw----)
> /dev/loop3 660 (brw-rw----)
> /dev/loop4 660 (brw-rw----)
> /dev/loop5 660 (brw-rw----)
> /dev/loop6 660 (brw-rw----)
> /dev/loop7 660 (brw-rw----)
I'd ask what the permissions on /dev are, but you're root and you can list
them, so...
> > 2) All the loop devices were busy (or somehow missed) and it iterated off
> > the end.
>
> I can't imagine that one cos only static is mounted as loop.
Yeah, seems unlikely.
> > Could you try something like:
> >
> > losetup /dev/loop3 stage3-python-2006.05.05.squash
> > mount -o ro -t squashfs /dev/loop3 /mnt/stage3/python
>
> Wow, now that works!
Yup, that's bypassing two different types of autodetect (the loop and the
filesystem type).
> Geode /mnt/stage1 $ losetup /dev/loop3
> /boot/stage3-python-2006.05.05.squash Geode /mnt/stage1 $ mount -o ro -t
> squashfs /dev/loop3 /mnt/stage3-python Geode /mnt/stage1 $ ls
> /mnt/stage3-python/
> usr
>
> > If that works, try removing the "-t squashfs"...
>
> Geode /mnt/stage1 $
> mount /boot/stage3-python-2006.05.05.squash /mnt/stage3-python -o ro
> mount: Couldn't setup loop device
> mount: Mounting (null) on /mnt/stage3-python failed: No such file or
> directory
>
> Thats what i tried earlier.
When I said "try removing the -t squashfs" I meant:
losetup /dev/loop3 stage3-python-2006.05.05.squash
mount -o ro /dev/loop3 /mnt/stage3/python
That tests whether it's the filesystem autodetection or the loop device
autodetection that's failing, by trying the filesystem autodetection with
manual loop device selection.
> As far as i know BB does not parse something like 'loop=/dev/loopX' - that
> might work too.
What?
> I still think it's confused somehow and tries to use /dev/loop0 which is
> still busy.
Seems unlikely.
> I forgot about strace and gave it a try:
> stat("/dev/loop/0", 0xbfcb66e4) = -1 ENOENT (No such file or
> directory)
Ok, there's your problem. You have devfs support enabled, but aren't using
devfs. It's looking for the loop devices using the devfs names, instead of
the normal names.
> Well, there seem to be 2 questions:
> 1. why does it use /dev/loop/0 and not /dev/loop0 ? maybe it should
> try /dev/loop0 too...
No, you should switch off devfs support if you're not using devfs.
> 2. why loop0 instead of loop1 (check on loop0 failed)
It iterates through loop devices until it finds a good one, and stops on a
file not found error. This works just fine when it's using the same naming
scheme as your /dev directory.
Switch off devfs support. It breaks stuff.
> I linked /dev/loop0 to /dev/loop/0 and /dev/loop1 to /dev/loop/1 - now
> mount works:
> Geode /dev/loop
> $ /bin/mount /boot/stage3-python-2006.05.05.squash /mnt/stage3-python -o ro
> Geode /dev/loop $ ls /mnt/stage3-python/
> usr
>
>
> I'm going to add those links to my setup but if you ask me BB should be
> able to work with the old naming too.
It does: when you disable devfs support.
> Thanks so far for your help.
>
>
> cheers Alex
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list