Mounting multiple loop-devices via BB

Rob Landley rob at landley.net
Tue May 9 15:28:32 UTC 2006


On Tuesday 09 May 2006 8:43 am, Alexander Krause wrote:
> Hi,
>
> I'm trying to mount a second loop device in a chroot but mount seems to be
> confused.

I'll be happy to fix this if I can reproduce it.

> The bootup works like this:
>
> echo "mounting boot device (${BOOTDEV})..."
> mount $BOOTDEV /boot -o rw
>
> echo "mounting static device (${STATIC})..."
> mount /boot/$STATIC /static -o ro,loop
>
> echo "mounting dynamic device (${DYNAMIC})..."
> mount $DYNAMIC /dynamic -o rw
>
> echo "merging /dynamic and /static into /vertex..."
> mount -t unionfs -o dirs=/dynamic=rw:/static=ro unionfs /vertex

You shouldn't have to specify -o loop with current busybox, it should 
autodetect it if you have loop support enabled.  But it shouldn't hurt 
anything, either.

My kernel isn't patched with unionfs, so I can't replicate that.  I'm guessing 
your $DYNAMIC is a writeable block device?

> echo "changing root and starting init..."
> cd /vertex
> pivot_root . mnt/stage1
> exec chroot . /bin/sh <<- EOF >/dev/console 2>&1
> exec $VINIT $CMDLINE
> EOF
>
> Now i'd like to mount another loop...
>
> Geode /boot $ mount stage3-python-2006.05.05.squash /mnt/stage3/python/ -o
> loop,ro
> mount: Couldn't setup loop device
> mount: Mounting (null) on /mnt/stage3/python/ failed: No such file or
> directory

Not a good error message, I'd like to track down which code path is 
responsible for that.

> BusyBox v1.1.2 with linux-2.6.17-rc2 is running on my device.
> And yes, i do have another /dev in my chroot ;-)
>
> I'm not quite sure what to do next.... any suggestions would be nice.

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.

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.

Did you build with legacy mtab support?  (Random question, shouldn't affect 
this, just curious.)

There's a couple of other possibilities:

1) It couldn't find or access /dev/loop* (permissions?)
2) All the loop devices were busy (or somehow missed) and it iterated off the 
end.

Could you try something like:

losetup /dev/loop3 stage3-python-2006.05.05.squash
mount -o ro -t squashfs /dev/loop3 /mnt/stage3/python

If that works, try removing the "-t squashfs"...

Rob
-- 
Never bet against the cheap plastic solution.



More information about the busybox mailing list