Incorrect disk order detection generates wrong menu.lst

Bug #217348 reported by Agostino Russo on 2008-04-14
38
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Wubi
High
Agostino Russo
grub-installer (Ubuntu)
Undecided
Evan
Hardy
Undecided
Evan

Bug Description

This is due to bug 8497 but I am keeping it separate because I would like to provide a wubi specific workaround.
One way is to add an extra boot menu option with kernel argument edd=on to address the issue.

See https://bugs.launchpad.net/ubuntu/+source/grub/+bug/8497

TEST CASE: On some systems with multiple disks, grub can set the root device incorrectly, causing a Wubi install to fail.

As suggested by bean123 and tinybit it is possible to modify the grub-installer line so that root is not set at all within menu.lst. This is because another menu.lst is used beforehand which will set root and then call configfile.

http://launchpadlibrarian.net/14092458/grub-installer-wubi.debdiff is a patch for hardy-proposed. Please note that ubiquity needs to be uploaded afterwards in order for this to be tested.

Potential regressions introduced by this patch should only be limited to Wubi installs as it is currently the only case in which grub-installer/bootdev_directory would be set.

Agostino Russo (ago) wrote :

postponed after final

Changed in wubi:
assignee: nobody → ago
importance: Undecided → Wishlist
status: New → Confirmed
Agostino Russo (ago) on 2008-04-14
description: updated
Agostino Russo (ago) wrote :

Many users with multiple disks are hit by this. Grub4dos supports the facility to set the root disk when a patterns match. The plan is to generate a UUID file and use "find --set-root UUID --relpath=/relative/path" instead of "root (hdX,Y)/relative/path". That also requires a change in grub4dos to support relative paths in the find command.

Changed in wubi:
importance: Wishlist → High
Agostino Russo (ago) on 2008-04-25
description: updated
Agostino Russo (ago) wrote :

In fact it is sufficient NOT to set root in menu.lst

What happens is that Wubi has an embedded menu.lst that looks for /ubuntu/disks/boot/grub/menu.lst and calls configfile. That already sets root to the disk and partition containing /ubuntu/disks/boot/grub/menu.lst. Since the disks will be in the same partition (/ubuntu/disks), setting root to /ubuntu/disks/boot/grub/menu.lst should not add much and if anything can point the bootloader to the wrong partition.

groot=(hdX,Y)/ubuntu/disks

should then be replaced

groot=()/ubuntu/disks

The latter sets only the relative path, but it does not change the root partition. This boot menu will only work when booted via wubildr (grub4dos), which should be acceptable since non-grub4dos bootloaders are not supported at this point and if the loopinstallation were to be migrated to a real partition, groot would have to be modified anyway.

Agostino Russo (ago) wrote :

It would be interesting to test that already. If you have Wubi installed:

sudo sed -i "s:(hd.*):():" /host/ubuntu/disks/boot/grub/menu.lst

Let me know if it works or not

Agostino Russo (ago) wrote :

--- grub-installer 2008-04-28 16:21:48.519362000 +0100
+++ grub-installer.new 2008-04-28 16:26:37.285702000 +0100
@@ -857,7 +857,7 @@
 fi

 if db_get grub-installer/bootdev_directory && [ "$RET" ]; then
- sed -i "/^# groot=/s:).*:)$RET:" $ROOT/boot/grub/$menu_file
+ sed -i "s:^# groot=(hd.*:# groot=()$RET:" $ROOT/boot/grub/$menu_file
        need_update_grub=1
 fi

Agostino Russo (ago) on 2008-04-28
Changed in wubi:
status: Confirmed → Fix Committed
Agostino Russo (ago) wrote :

The above patch was tested successfully by myself and davmor2.

description: updated
Agostino Russo (ago) on 2008-04-29
Changed in wubi:
milestone: none → 8.04.1
Agostino Russo (ago) wrote :

On second thought, using:

find --set-root --relative=/ubuntu/disks /ubuntu/disks/boot/grub/menu.lst

is more generic and even if setting the root is superfluous in the case of Wubi the setup above might be useful where the grub menu is used directly without going through the embedded menu.lst. The disadvantage is that using find --relative requires upgrading the grub package (which will probably be required anyway because of other patches).

--- grub-installer 2008-04-28 16:21:48.519362000 +0100
+++ grub-installer.new 2008-04-28 16:26:37.285702000 +0100
@@ -857,7 +857,7 @@
 fi

if db_get grub-installer/bootdev_directory && [ "$RET" ]; then
- sed -i "/^# groot=/s:).*:)$RET:" $ROOT/boot/grub/$menu_file
+ sed -i "s:^# groot=:# groot=find --set-root --relative=$RET $RET/boot/grub/$menu_file:" $ROOT/boot/grub/$menu_file
        need_update_grub=1
 fi

A variation of the above involves looking for a UUID file as opposed to looking for menu.lst as suggested by Colin.

Agostino Russo (ago) wrote :

s/requires upgrading the grub package/requires upgrading the grub4dos package/

Agostino Russo (ago) wrote :

The find syntax has been changed slightly in grub4dos. Now it is: find --set-root=/relative/path /path/to/file/to/search

Please do the following test.

Within a wubi installation edit /boot/grub/menu.lst so that the #groot line reads:

#groot=find --ignore-floppies --set-root=/ubuntu/disks /ubuntu/disks/boot/grub/menu.lst

Save and run:

sudo update-grub

Then in Windows unpack the attached wubildr.zip into both C:\ (or whatever is your boot drive) and C:\ubuntu\winboot. Make sure that any existing wubildr* file is overwritten with the new ones. Then try to boot into Ubuntu. More points if you have multiple disks.

Agostino Russo (ago) on 2008-05-02
Changed in wubi:
status: Fix Committed → In Progress
Evan (ev) wrote :

From discussions in #ubuntu-installer we've determined that https://bugs.launchpad.net/wubi/+bug/217348/comments/9 will not work without modification to update-grub, which is too invasive for 8.04.1.

Therefor we will implement https://bugs.launchpad.net/wubi/+bug/217348/comments/5 for 8.04.1 and implement the better long-term solution in 8.10.

Changed in grub-installer:
assignee: nobody → evand
status: New → In Progress
Agostino Russo (ago) wrote :

Forget the above post, that will not work since update-grub will use groot to generate lines such as "root find --set-root" as opposed to "find --set-root".

We will go for the solution in #5 then!

groot=(hdX,Y)/ubuntu/disks => groot=()/ubuntu/disks
+
update-grub

Evan (ev) wrote :
description: updated
description: updated
Changed in grub-installer:
milestone: none → ubuntu-8.04.1
assignee: nobody → evand
status: New → Fix Committed
Evan (ev) on 2008-05-02
Changed in grub-installer:
status: In Progress → Fix Committed
Steve Langasek (vorlon) on 2008-05-02
Changed in grub-installer:
milestone: none → ubuntu-8.04.1
milestone: ubuntu-8.04.1 → none
Steve Langasek (vorlon) wrote :

accepted into hardy-proposed.

Agostino Russo (ago) on 2008-05-04
Changed in wubi:
status: In Progress → Fix Committed
Evan (ev) on 2008-05-09
Changed in grub-installer:
status: Fix Committed → Fix Released
status: Fix Committed → Fix Released
Agostino Russo (ago) on 2008-05-27
Changed in wubi:
status: Fix Committed → Fix Released
Steve Langasek (vorlon) on 2008-06-12
Changed in grub-installer:
status: Fix Released → Fix Committed

hardy test CD images are now available which include the updated installer
components that address this bug:

  http://cdimage.ubuntu.com/hardy/daily/20080612.4/

Please test these images and report your results so we can verify whether
this bug is fixed.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>

Dave Morley (davmor2) wrote :

Seems to be fixed with wubi 503 on 20080620.1 hardy.1 cd

Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in grub-installer:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments