Unable to install grub2 onto vfat partition

Bug #401971 reported by Mario Limonciello
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: grub2

I've got a particular situation that prevents grub2 from being installed onto the MBR, but instead requires it to be installed onto the PBR of a fat32 partition.

I receive a handful of errors when trying to install to it, and then i'm unable to actually boot from it. My grub.cfg doesn't even get read.

# mount | grep /boot
/dev/sda2 on /boot type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,errors=remount-ro)

$ sudo fdisk -l /dev/sda

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

   Device Boot Start End Blocks Id System
/dev/sda1 1 34 273073+ de Dell Utility
/dev/sda2 * 35 197 1309297+ b W95 FAT32

$ sudo grub-install --modules=fat /dev/sda2

grub-probe: error: unknown filesystem
grub-setup: warn: Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea.
grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and its use is discouraged.
grub-setup: error: Cannot read `/boot/grub/core.img' correctly

# cat /boot/grub/grub.cfg

set default=0
set timeout=5
set root=(hd0,2)
set color_normal=white/black
set color_highlight=black/white
set menu_color_normal=white/black
set menu_color_highlight=black/white

menuentry "Automatic Reinstallation" {
  linux /casper/vmlinuz preseed/file=/cdrom/preseed/dell.seed boot=casper automatic-ubiquity noprompt edd=on splash quiet
  initrd initrd /casper/initrd.lz
}

ProblemType: Bug
Architecture: i386
Date: Mon Jul 20 23:15:22 2009
DistroRelease: Ubuntu 9.10
LiveMediaBuild: Ubuntu 9.10 "Karmic Koala" - Alpha i386 (20090720)
Package: grub-pc 1.96+20090611-1ubuntu4
ProcEnviron:
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-3.19-generic
SourcePackage: grub2
Uname: Linux 2.6.31-3-generic i686

Related branches

Revision history for this message
Mario Limonciello (superm1) wrote :
Revision history for this message
Mario Limonciello (superm1) wrote :

Might also be useful:

# sudo grub-probe -d /dev/sda2 --verbose
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: the size of hd1 is 7936000
grub-probe: info: /dev/sda2 starts from 546210
grub-probe: info: opening the device hd0
grub-probe: info: the size of hd0 is 625142448
grub-probe: info: DOS partition 0 starts from 63
grub-probe: info: DOS partition 1 starts from 546210
grub-probe: info: opening hd0,2
grub-probe: info: the size of hd0 is 625142448
grub-probe: error: unknown filesystem

Revision history for this message
Felix Zielcke (fzielcke) wrote :

If grub-probe fails to detect it, then real grub probable won't work with it either.
In the current version there's a bug with installing to FAT32 which actually could destroy the filesystem.
It's fixed upstream since 2009-07-15, but there's not even a Debian upload which includes this yet.

Revision history for this message
Felix Zielcke (fzielcke) wrote :

I just uploaded now a new version to Debian sid which contains this bugfix.
But it's strange that grub-probe already failed to detect it as valid fat fs.
Could you plesae attach a dump of first 512 bytes of it?
You can get it with `sudo dd if=/dev/sda2 of=fat.bs count=1 bs=512'. It's in fat.bs then.
Maybe it helps if you would run dosfsck (in package dosfstools) or chkdsk on Windows over it.

Revision history for this message
Mario Limonciello (superm1) wrote :

Hi Felix:

Thanks for tracking down this fix. I just compiled the new upload you put in debian on a karmic sbuild, formatted the partition and tried it all again. Works properly now. So as soon as karmic a3's soft freeze is up, can merge with you guys.

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

This bug was fixed in the package grub2 - 1.96+20090725-1ubuntu1

---------------
grub2 (1.96+20090725-1ubuntu1) karmic; urgency=low

  * New upstream version.
    + Fixes offering Windows (LP: #402795)
    + Fixes Vista/Win7 fails to boot (LP: #402154)
    + Fixes installation onto VFAT (LP: #401971)
  * Merge from debian unstable, remaining changes:
    + debian/control:
      - Depend on rather than Suggest os-prober; Ubuntu version does not
        suffer from the mount problem that prevents Debian from marking this
        Depends.
    + debian/default/grub:
      - Adjust for default Ubuntu boot options.
      - Use new GRUB_CMDLINE_LINUX_DEFAULT option to set "quiet splash" for
        default items only. These options won't be set in single user mode.
    + debian/legacy/update-grub:
      - Apply Ubuntu branding: title, recovery mode, quiet option, and tweak
        how memtest86+ is displayed.
      - Use UUIDs where appropriate.
    + debian/patches/03_ubuntu_grub_standards:
      - Remove GNU/Linux from default string.
    + debian/patches/10_crashkernel.patch:
      - add crashkernel= options if kdump and makedumpfile
        is available (part of the kernel-crashdump spec)
  * Update 10_crashkernel.patch for changes upstream.
  * Drop 999_os-prober_drivemap_root.diff, upstream.

 -- Mario Limonciello <email address hidden> Thu, 30 Jul 2009 12:41:19 -0500

Changed in grub2 (Ubuntu):
status: New → Fix Released
Revision history for this message
Hans van den Bogert (hbogert) wrote :

I can't seem to get it done,
I issue grub-installl --modules=fat --rootdirectory=/media/00xxxx/ /dev/sdb

Now when I boot from it, it halts in rescue mode ("grub rescue>"), stating that it is a invalid partition

Revision history for this message
Hans van den Bogert (hbogert) wrote :

false alarm, although I don't understand what really happened. check on the fat partition with gparted made it magically work

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.