Add /host/boot to fstab

Bug #173659 reported by Agostino Russo
4
Affects Status Importance Assigned to Milestone
Wubi
Fix Released
Medium
Agostino Russo
partman-auto-loop (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: partman-auto-loop

The following line should be added to fstab whenever we are dealing with a loop installation that has the boot folder as a directory inside of the host filesystem (in the case below /host/ubuntu/disks/boot):

/host/ubuntu/disks/boot /boot none bind 0 0

Tags: wubi
Revision history for this message
Agostino Russo (ago) wrote :

Untested, but something along those lines in /lib/partman/fstab.d might do the trick. The script checks whether / is on a loopfile and whether there is a "boot" directory in the same path of the loopfile, in which case it bindsmount boot.

#!/bin/sh

. /lib/partman/definitions.sh

for dev in $DEVICES/*; do
    [ -d $dev ] || continue
    cd $dev
    open_dialog PARTITIONS
    while { read_line num id size type fs path name; [ "$id" ]; }; do
        [ $fs != free ] || continue
        [ -f "$id/method" ] || continue
        [ -f "$id/acting_filesystem" ] || continue
        [ -f "$id/mountpoint" ] || continue
        method=$(cat $id/method)
        mountpoint=$(cat $id/mountpoint)
        if [ "$mountpoint" = / ]; then
            options=$(get_mountoptions $dev $id)
            [ "$options" = ${options#*loop} ] && exit 0
            path=${path%/*}
            [ -d "$path/boot" ] || exit 0
            echo "$path/boot" /boot none bind 0 0
        fi
    done
    close_dialog
done

Revision history for this message
Agostino Russo (ago) wrote :

Following version works (better). Mounting scripts in /lib/partman/finish.d do not seem to digest bindmounts though, will give a better look tomorrow.

#!/bin/sh

. /lib/partman/definitions.sh

finish(){
 close_dialog
 exit 0
}

for dev in $DEVICES/*; do
 [ -d $dev ] || continue
 cd $dev
 open_dialog PARTITIONS
 while { read_line num id size type fs path name; [ "$id" ]; }; do
     [ $fs != free ] || continue
     [ -f "$id/method" ] || continue
     [ -f "$id/acting_filesystem" ] || continue
     [ -f "$id/mountpoint" ] || continue
  [ "$(cat $id/mountpoint)" = / ] || continue
  [ -f "loop" ] || finish
  loopfile=$(cat loop)
  loopdir=${loopfile%/*}
  [ -n "$loopdir" ] || finish
  [ "$loopdir" != / ] || finish
  [ -d "$loopdir/boot" ] || finish
  echo "$loopdir/boot" /boot none bind 0 0
  finish
    done
 close_dialog
done

Revision history for this message
Agostino Russo (ago) wrote :

Following is /lib/partman/mount.d/70bind which is required to mount entries of fstab that use binding

#!/bin/sh
set -- $1

fs=$1
mp=$2
type=$3
options=$4
dump=$5
pass=$6

case "$options" in
    *bind*)
        mount -o "$options" $fs /target$mp || exit 1
        echo "umount /target$mp"
        exit 0
        ;;
esac

exit 1

Revision history for this message
Agostino Russo (ago) wrote :

For a more recent versions of the patches above please see:

https://code.launchpad.net/~ago/partman-auto-loop/lupin-support

Agostino Russo (ago)
Changed in wubi:
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Agostino Russo (ago) wrote :

It might be safer to add the following check to /lib/partman/mount.d/70bind

[ "$type" = none ] || exit 1

Revision history for this message
Evan (ev) wrote :

Upon closer inspection and testing this out, I've realized that this will apply for cases where someone wants to have a loop install inside a Linux partition where /boot is also present, such as the default Ubuntu install. This is problematic as it seemingly breaks such setups.

Revision history for this message
Agostino Russo (ago) wrote :

Evan,

If you loopinstall inside linux, it will use /loopinstallation/disks/boot as /boot when you are within the loopinstallation. Then the user will have to add an option to their regular grub pointing at /loopinstallation/disks/boot/grub/menu.lst. I did not test this configuration, but I assume that is what should happen. Hence I do not see how the patch is problematic for linux based loopinstallations.

Basically the /boot folder of a loopinstallation is always separate from the user regular /boot folder, and a menu item in their regular bootloader will redirect to the loopinstallation boot menu. This is basically the same behaviour whether you use windows or linux.

Revision history for this message
Evan (ev) wrote :

My mistake. I somehow missed the obvious, that /boot needs to be outside the loop.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package partman-auto-loop - 0ubuntu13

---------------
partman-auto-loop (0ubuntu13) hardy; urgency=low

  [ Agostino Russo ]
  * Allow disk images to be created externally (LP: #176019).
  * Added template required by autopartition-loop.

  [ Evan Dandrea ]
  * Add /host/boot to fstab (LP: #173659). Thanks Agostino Russo.

 -- Evan Dandrea <email address hidden> Fri, 18 Jan 2008 15:58:52 -0500

Changed in partman-auto-loop:
status: New → Fix Released
Agostino Russo (ago)
Changed in wubi:
assignee: nobody → ago
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.