mdraid1x core image too large for minimal MBR?

Bug #1051154 reported by Nick Semenkovich
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
High
Colin Watson

Bug Description

I've been running Quantal on a machine for a while now, and everything has been smooth.

However, I just took the recent grub2 & kernel updates which seemed to break grub2:
* grub-pc-bin:amd64 (1.99-22ubuntu2, 2.00-4ubuntu1)
* linux-image-3.5.0-14-generic:amd64 (3.5.0-14.16, 3.5.0-14.19)

Grub2 now complains:

/usr/sbin/grub-bios-setup: warning: your embedding area is unusually small. core.img won't fit in it..
/usr/sbin/grub-bios-setup: error: embedding is not possible, but this is required for RAID and LVM install.
/usr/sbin/grub-bios-setup: warning: your embedding area is unusually small. core.img won't fit in it..
/usr/sbin/grub-bios-setup: error: embedding is not possible, but this is required for RAID and LVM install.

Are there any workarounds for this?

This is a very simple install, just md RAID1, with one dumb partition, no LVM.

$ sudo parted /dev/sda
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA HDS725050KLA360 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 500GB 500GB primary ext4 raid

$ sudo parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA HDS725050KLA360 (scsi)
Disk /dev/sdb: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 500GB 500GB primary ext4 boot, raid

$ uname -ar
Linux machine-1 3.5.0-14-generic #16-Ubuntu SMP Mon Sep 10 21:57:14 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: grub2 (not installed)
ProcVersionSignature: Ubuntu 3.5.0-14.16-generic 3.5.3
Uname: Linux 3.5.0-14-generic x86_64
ApportVersion: 2.5.1-0ubuntu7
Architecture: amd64
Date: Fri Sep 14 23:38:19 2012
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: grub2
UpgradeStatus: Upgraded to quantal on 2012-03-05 (194 days ago)

Related branches

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in grub2 (Ubuntu):
status: New → Confirmed
Revision history for this message
Laurie Bradshaw (lauriebradshaw) wrote :

I'm seeing a very similiar issue, although with no raid setup - just a single sata disk, standard partition table, nothing complex.

/usr/sbin/grub-bios-setup: warning: this LDM has no Embedding Partition; embedding won't be possible.
/usr/sbin/grub-bios-setup: error: embedding is not possible, but this is required for RAID and LVM install.

$ fdisk -l

Disk /dev/sda: 300.1 GB, 300069052416 bytes
255 heads, 63 sectors/track, 36481 cylinders, total 586072368 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8f83bc52

   Device Boot Start End Blocks Id System
/dev/sda1 562628430 586067264 11719417+ 82 Linux swap / Solaris
/dev/sda2 * 63 562628429 281314183+ 83 Linux

Currently resorting to manually installing grub 1.99-22ubuntu2 every time I update so the system actually boots.

Revision history for this message
Nick Semenkovich (semenko) wrote :

If it helps:

$ sudo fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe6d4e6d4

   Device Boot Start End Blocks Id System
/dev/sda1 63 976768064 488384001 fd Linux raid autodetect

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe6d4e6d4

   Device Boot Start End Blocks Id System
/dev/sdb1 * 63 976768064 488384001 fd Linux raid autodetect

Disk /dev/md0: 500.1 GB, 500105150464 bytes
2 heads, 4 sectors/track, 122095984 cylinders, total 976767872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md0 doesn't contain a valid partition table

$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.5.0-14-generic
Found initrd image: /boot/initrd.img-3.5.0-14-generic
Found memtest86+ image: /boot/memtest86+.bin
  No volume groups found
Found Ubuntu quantal (development branch) (12.10) on /dev/sda1
Found Ubuntu quantal (development branch) (12.10) on /dev/sdb1
done

$ sudo grub-install --force --no-floppy /dev/sda
/usr/sbin/grub-bios-setup: warning: your embedding area is unusually small. core.img won't fit in it..
/usr/sbin/grub-bios-setup: error: embedding is not possible, but this is required for RAID and LVM install.

Interestingly, update-grub seems to write a semi-incorrect file:

The chunk derived from: /etc/grub.d/30_os-prober

references a few kernels that no longer exist, e.g.
  menuentry 'Ubuntu, with Linux 3.5.0-13-generic
  menuentry 'Ubuntu, with Linux 3.5.0-9-generic
etc.

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

@Laurie (#2), could you please file your bug separately? It looks distinct from Nick's problem: in your case, it appears that your disk is being detected as https://en.wikipedia.org/wiki/Logical_Disk_Manager (presumably incorrectly since you don't mention Windows). It would be helpful to extract the first megabyte or so and the last megabyte or so of your disk using dd, and attach that to the bug report.

Changed in grub2 (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
summary: - [quantal] warning: your embedding area is unusually small. core.img
- won't fit in it.
+ lvm+mdraid1x core image too large for minimal MBR
summary: - lvm+mdraid1x core image too large for minimal MBR
+ mdraid1x core image too large for minimal MBR
Revision history for this message
Colin Watson (cjwatson) wrote : Re: mdraid1x core image too large for minimal MBR

Well, I updated the description for now, but it's not clear that a core.img with mdraid1x is actually over the limit:

(precise-amd64)root@sarantium:~# grub-mkimage -O i386-pc --output=core.img biosdisk ext2 part_msdos mdraid1x
(precise-amd64)root@sarantium:~# ls -l core.img
-rw-r--r-- 1 root root 29451 Sep 18 16:06 core.img

(quantal-amd64)root@sarantium:~# grub-mkimage -O i386-pc --output=core.img biosdisk ext2 part_msdos diskfilter mdraid1x
(quantal-amd64)root@sarantium:~# ls -l core.img
-rw-r--r-- 1 root root 31362 Sep 18 16:06 core.img

Since the first sector contains the MBR and partition table, that leaves 62 sectors == 31744 bytes, which should be enough.
Can you confirm that the second of these matches the size of your /boot/grub/core.img? It would also be helpful if you could attach the first 32KB of each disk:

  sudo hd -n32768 /dev/sda >sda.start
  sudo hd -n32768 /dev/sdb >sdb.start

Changed in grub2 (Ubuntu):
assignee: nobody → Colin Watson (cjwatson)
summary: - mdraid1x core image too large for minimal MBR
+ mdraid1x core image too large for minimal MBR?
Revision history for this message
Nick Semenkovich (semenko) wrote :

I see similar core sizes:
$ grub-mkimage -O i386-pc --output=core.img biosdisk ext2 part_msdos mdraid1x
$ ls -l core.img
-rw-rw-r-- 1 semenko semenko 31362 Sep 18 10:22 core.img

$ grub-mkimage -O i386-pc --output=core.img biosdisk ext2 part_msdos diskfilter mdraid1x
$ ls -l core.img
-rw-rw-r-- 1 semenko semenko 31362 Sep 18 10:23 core.img

That's also similar to the core.img size in /boot/
$ ls -l /boot/grub/i386-pc/core.img
-rw-r--r-- 1 root root 31394 Sep 15 17:06 /boot/grub/i386-pc/core.img

Revision history for this message
Nick Semenkovich (semenko) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

Similar but not quite identical. Hmm. Thanks for the dumps - I'll look at those shortly, though I'm currently trying to set up a direct reproduction environment. Any chance you could also provide the output of 'sudo grub-install --debug /dev/sda' so that, among other things, I can make sure I'm using the correct set of modules here?

Revision history for this message
Nick Semenkovich (semenko) wrote :

Of course! Let me know if there's any other way I can help.

$ sudo grub-install --debug /dev/sda > grub-install-debug_dev_sda.log 2>&1
[attached]

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

I can reproduce this with a straight amd64 server install with partman/alignment=cylinder and a single partition on RAID1.

Changed in grub2 (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed upstream. I'll merge this into the packaging within the day.

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

2012-09-19 Colin Watson <email address hidden>

        * grub-core/partmap/msdos.c (pc_partition_map_embed): Revert
        incorrect off-by-one fix from 2011-02-12. A 62-sector core image
        should fit before end == 63.

Revision history for this message
Nick Semenkovich (semenko) wrote :

Awesome -- many thanks!

- Nick

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

This bug was fixed in the package grub2 - 2.00-5ubuntu1

---------------
grub2 (2.00-5ubuntu1) quantal; 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.
    - 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.
    - 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.
    - Set vt.handoff=7 for smooth handoff to kernel graphical mode.
    - 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.
    - Disable cursor as early as possible in grub_main.
    - Avoid getting confused by inaccessible loop device backing paths.
    - Apply patch from Fedora to forbid insmod on UEFI secure boot.

grub2 (2.00-5) experimental; urgency=low

  * Backport from upstream:
    - Remove extra layer of escaping from grub_probe.
    - Add efifwsetup module to reboot into firmware setup menu.
    - Revert incorrect off-by-one fix when embedding in MBR (LP: #1051154).
  * Switch watch file to point to ftp.gnu.org.
  * Build-depend on liblzma-dev, enabling 'grub-mkimage -C xz'.
  * Adjust /etc/grub.d/30_os-prober to detect Ubuntu's use of "recovery"
    rather than "single".
 -- Colin Watson <email address hidden> Wed, 19 Sep 2012 10:56:33 +0100

Changed in grub2 (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Michael Shigorin (shigorin) wrote :

Thank you, Colin!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers