Boot from FAT32 error and return to grub menu

Bug #888281 reported by Pesmontis
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Wubi
Confirmed
Undecided
Unassigned
grub2 (Ubuntu)
Fix Released
Medium
Colin Watson

Bug Description

This problem was observed on an i386 machine with a fresh Wubi installation of Ubuntu Oneiric Ocelot on a FAT32 primary partition.

Booting the default grub menu selection results in the message "You need to load the kernel first", and a subsequent return to the grub menu.
Once returned to the Grub menu, I only have to press <Enter> to properly boot Oneiric.

My previous Wubi Natty set-up did not show this error.

My old machine is set-up for multi-boot:
1. c: partition FAT32 with Win98se;
2. XP on NTFS in an extended DOS partition;
3. a fresh Wubi Oneiric installation on the c:-drive.

After a fresh Wubi Oneiric install, the Grub menu has only the two default entries.
My partitions are: (memdisk) (hd0) (loop0) (hd0,msdos5) (hd0,msdos2) (hd1) (hd1,msdos1)..

Tags: patch
Revision history for this message
Pesmontis (pesmontis) wrote :
Revision history for this message
bcbc (bcbc) wrote :

I've duplicated this problem - installing on a FAT32 partition with size > 4GB. This creates a separate usr.disk and this seems to be resulting in a problem in processing grub.cfg when loop0 is reset from usr.disk to root.disk.

Changed in wubi:
status: New → Confirmed
Revision history for this message
bcbc (bcbc) wrote :

This also happens when changing the root.disk (e.g. through a custom boot entry). In my case, I added a custom menu entry to boot a copy of my root.disk (new.disk). First time I select it I get the "You have to load the kernel", hit Enter to return to the grub menu. If I then select the custom entry it boots fine. If I didn't select the custom entry (i.e. the normal root.disk) I get the same error, and then after returning it boots.

So it seems to be the act of replacing the loop device that causes the issue.

I'll try experimenting. e.g. does the initial loop device have to be the same as the one in the menu entries? I'll play around a bit and see if I can get a workaround.

Revision history for this message
bcbc (bcbc) wrote : Re: [Bug 888281] Re: Boot from FAT32 error and return to grub menu

Modifying to use loop1 in the menu entry works:
menuentry 'Ubuntu - backup new.disk' --class ubuntu --class gnu-linux
--class gnu --class os {
        set gfxpayload=$linux_gfx_mode
        insmod part_msdos
        insmod ntfs
        set root='(hd0,msdos3)'
        search --no-floppy --fs-uuid --set=root 18B4B7BBB4B799A8
        loopback loop1 /ubuntu/disks/new.disk
        set root=(loop1)
        linux /vmlinuz root=UUID=18B4B7BBB4B799A8
loop=/ubuntu/disks/new.disk ro quiet splash vt.handoff=7
        initrd /initrd.img
}

Not sure if this has memory implications, but it seems like it would solve
this problem for FAT32 if the usr.disk was setup on loop1.

Revision history for this message
bcbc (bcbc) wrote :
Revision history for this message
bcbc (bcbc) wrote :

The patch is for file: /usr/lib/grub/grub-mkconfig_lib
This is from package: grub-common

It produces no diff for my own wubi install's grub.cfg (single virtual disk), I'll test it on the FAT32 install and confirm that it resolves it when I have time.

Revision history for this message
Stéphane Graber (stgraber) wrote :

Added a task for grub2 in Ubuntu as the patch above is for it.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "grub-mkconfig_lib.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
bcbc (bcbc) wrote :

I've just tested the patch on a FAT32 wubi install and it worked as intended.

In order to test it, I manually edited the /usr/share/grub/grub-mkconfig_lib file during the installation (patch wasn't installed), used 'diff' to confirm it matched the patch, and then copied it to /target/usr/share/grub/grub_mkconfig_lib (/target/usr is the mount point for /dev/loop4 which is for the usr.disk virtual disk). And root.disk was mounted as /dev/loop2 on /target.

The grub.cfg that was generated during the install is attached, and it shows that usr.disk will be mounted on loop4 by grub and root.disk is mounted as loop2:
insmod part_msdos
insmod fat
set root='(hd1,msdos5)'
search --no-floppy --fs-uuid --set=root 2dab-fe25
loopback loop4 /ubuntu/disks/usr.disk
set root=(loop4)
if loadfont /share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod fat
  set root='(hd1,msdos5)'
  search --no-floppy --fs-uuid --set=root 2dab-fe25
  loopback loop2 /ubuntu/disks/root.disk
  set root=(loop2)
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi
...

After rebooting and selecting the Wubi install, there was no error or return to the menu. Then running "sudo update-grub" resulted in grub.cfg changing the loop device for usr.disk to loop1 and root.disk to loop0 (as expected):
insmod part_msdos
insmod fat
set root='(hd1,msdos5)'
search --no-floppy --fs-uuid --set=root 2dab-fe25
loopback loop1 /ubuntu/disks/usr.disk
set root=(loop1)
if loadfont /share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod fat
  set root='(hd1,msdos5)'
  search --no-floppy --fs-uuid --set=root 2dab-fe25
  loopback loop0 /ubuntu/disks/root.disk
  set root=(loop0)
  set locale_dir=($root)/boot/grub/locale
  set lang=en_US
  insmod gettext
fi

Revision history for this message
bcbc (bcbc) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

Please use 'diff -u' when generating diffs. Context diffs are difficult to read, and are especially painful when there's no actual context included. Also, put the previous version on the diff command line before the new version so that the patch doesn't come out reversed.

As for the substance of the patch, I had to think about it a bit to convince myself that it was safe to use Linux's loop device ordering as a unique key for GRUB's loop device naming, but after consideration I agree that it's fine. I'll apply this patch for my next upload.

Colin Watson (cjwatson)
Changed in grub2 (Ubuntu):
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
bcbc (bcbc) wrote :

Okay, I see the difference in the diff -u output, and my ordering mistake. I'll make a note of that.
Thanks

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

This bug was fixed in the package grub2 - 1.99-18ubuntu1

---------------
grub2 (1.99-18ubuntu1) precise; urgency=low

  * Resynchronise with Debian. Remaining changes:
    - Adjust for default Ubuntu boot options ("quiet splash").
    - Default to hiding the menu; holding down Shift at boot will show it.
    - Set a monochromatic theme and an appropriate background for Ubuntu.
    - Apply Ubuntu GRUB Legacy changes to legacy update-grub script.
    - Fix backslash-escaping in merge_debconf_into_conf.
    - Remove "GNU/Linux" from default distributor string.
    - Add crashkernel option.
    - Bypass menu unless other OSes are installed or Shift is pressed.
    - Allow Shift to interrupt 'sleep --interruptible'.
    - Reduce visual clutter in normal mode.
    - Remove verbose messages printed before reading configuration.
    - Suppress kernel/initrd progress messages, except in recovery mode.
    - Show the boot menu if the previous boot failed.
    - Don't generate device.map during grub-install or grub-mkconfig.
    - Adjust upgrade version checks for Ubuntu.
    - Suppress "GRUB loading" message unless Shift is held down.
    - Adjust versions of grub-doc and grub-legacy-doc conflicts.
    - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
    - Look for .mo files in /usr/share/locale-langpack first.
    - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
    - Check hardware support before using gfxpayload=keep.
    - Put second and subsequent Linux menu entries in a submenu.
    - Preferred resolution detection for VBE.
    - Set vt.handoff=7 for smooth handoff to kernel graphical mode.
    - Update default/grub.md5sum to include maverick's default md5sum.
    - In recovery mode, add nomodeset to the Linux kernel arguments, and
      remove the 'set gfxpayload=keep' command.
    - Skip Windows os-prober entries on Wubi systems, and suppress the menu
      by default if those are the only other-OS entries.
    - Handle probing striped DM-RAID devices.
    - Replace 'single' by 'recovery' when friendly-recovery is installed.
    - Use qemu -no-kvm in tests for now to work around LP #947597.
    - Disable cursor as early as possible in grub_main.

grub2 (1.99-18) unstable; urgency=low

  [ Colin Watson ]
  * Ensure that /sbin and /usr/sbin are in $PATH when running tests (closes:
    #662916).
  * mkconfig_loopback.patch: Use different GRUB loop devices for different
    OS loop devices (thanks, bcbc; LP: #888281).
  * Backport from upstream:
    - Add support for LZO compression in btrfs (LP: #727535).
    - Fix efiemu configure check.

  [ Ilya Yanok ]
  * Backport from upstream:
    - Make FAT UUID uppercase to match Linux (LP: #948716).

  [ Debconf translations ]
  * Norwegian Bokmål (Hans Fredrik Nordhaug).
  * Gujarati (Kartik Mistry). Closes: #663542
 -- Colin Watson <email address hidden> Mon, 19 Mar 2012 20:00:22 +0000

Changed in grub2 (Ubuntu):
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.