grub2: installing onto a PBR rather than an MBR can render some systems unbootable

Bug #741867 reported by Colin Ian King on 2011-03-24
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OEM Priority Project
High
Unassigned
grub2 (Ubuntu)
High
Colin Watson

Bug Description

Binary package hint: grub2

Installing grub onto a partition rather than the MBR seems to render some systems totally unbootable.

Using daily ISO from cdimage.ubuntu.com, and installing on a clean HDD w/o an MBR:

1) dd if=/dev/zero of=/dev/sdb bs=512 count=2048
2) Install the system using manual partitioning
     a) Create a single large partition, ext4, mountpoint /
     b) Choose to install the bootloader to this new partition /dev/sdb1

This should install grub to the PBR, set the partition active and should the initial bootstrap code into the PBR. On some machines the system is rendered unbootable.

Mario Limonciello bisected this down to r2751 causing the fault:

Here's the bisection log:

<email address hidden> start
<email address hidden> yes
proski@localhost-20090720134841-rdhss6osd98khqxj no
<email address hidden> no
<email address hidden> yes
<email address hidden> no
<email address hidden> no
<email address hidden> yes
<email address hidden> yes
<email address hidden> yes
<email address hidden> yes
<email address hidden> yes
<email address hidden> yes
<email address hidden> no
<email address hidden> no
<email address hidden> done

Related branches

Colin Ian King (colin-king) wrote :
Colin Ian King (colin-king) wrote :

Mario states:

"So armed with above, the attached patch (reference to trunk) appears to fix it for me. I'm not positive it is the right way to implement the solution."

description: updated
tags: added: patch
Chris Van Hoof (vanhoof) on 2011-03-24
tags: added: hwe-blocker
Kent Baxley (kentb) on 2011-03-24
Changed in oem-priority:
importance: Undecided → High
Colin Watson (cjwatson) on 2011-03-25
Changed in grub2 (Ubuntu):
importance: Undecided → High
status: New → Triaged
assignee: nobody → Colin Watson (cjwatson)
Colin Watson (cjwatson) wrote :

This patch will break installing GRUB to a floppy disk, because the floppy_probe code in boot.S will be overwritten with whatever's currently in that location on the floppy. I think you probably need a condition a bit like this in there:

  if (allow_floppy && grub_util_biosdisk_is_floppy (dest_dev->disk))

After fixing this, would you mind sending the patch upstream (<email address hidden>) for review? It might be worth including a rationale rather like the inferred one I posted to the corresponding private bug, if you agree with it: i.e. that this seems to be because the BIOS is asserting that a partition boot record does not contain anything that looks a bit like a valid partition table.

Colin Watson (cjwatson) wrote :

Actually I think that should be || rather than &&, considering the definition of --allow-floppy ("Make the drive also bootable as floppy (default for fdX devices)").

Colin Watson (cjwatson) wrote :

Vladimir committed this upstream. I've cherry-picked it for the next Debian upload, which I'll merge into Ubuntu.

Changed in grub2 (Ubuntu):
status: Triaged → Fix Committed
Launchpad Janitor (janitor) wrote :
Download full text (3.2 KiB)

This bug was fixed in the package grub2 - 1.99~rc1-8ubuntu1

---------------
grub2 (1.99~rc1-8ubuntu1) natty; 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 aubergine background for Ubuntu.
    - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
      recovery mode, quiet option, tweak how memtest86+ is displayed, and
      use UUIDs where appropriate.
    - 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.
    - Handle filesystems loop-mounted on file images.
    - Ignore devices loop-mounted from files in Linux grub.d scripts.
    - 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.
    - Add a grub-rescue-efi-amd64 package.
    - On Wubi, don't ask for an install device, but just update wubildr
      using the diverted grub-install.
    - Check hardware support before using gfxpayload=keep.
    - Build part_msdos and vfat into EFI boot images.
    - 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.
  * Drop patch to use qemu rather than qemu-system-i386, now that qemu-kvm
    ships a symlink.
  * Rewrite hwmatch.lua in C. Drop lua grub-extras module.
  * Update ubuntu_vbe_autodetect.patch, bringing GRUB_GFXMODE documentation
    up to date.
  * Fix use of freed memory when replacing existing loopback device
    (LP: #742967).

grub2 (1.99~rc1-8) unstable; urgency=low

  * Cherry-pick from upstream:
    - Fix FreeBSD compilation problem.

grub2 (1.99~rc1-7) unstable; urgency=low

  * Add /proc/mdstat, LVM information, and listings of /dev/disk/by-id/ and
    /dev/disk/by-uuid/ to bug reports, by request of upstream.
  * Cherry-pick from upstream:
    - Use libgeom on FreeBSD to detect partitions (closes: #612128).
    - Copy the partition table zone if floppy support is disabled, even if
      no partition table is found (LP: #741867).
    - Fix an ext2 overflow affecting inodes past 2TiB.
    - Fix RAID-0 disk size calculation for metadata 1.x (LP: #743136).
  * Merge from Ubuntu:
    - Build with gcc-4.5 on ppc64.
    - Add apport hook for ProblemType = 'Package', thanks to...

Read more...

Changed in grub2 (Ubuntu):
status: Fix Committed → Fix Released
Chris Van Hoof (vanhoof) on 2011-04-01
Changed in oem-priority:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers