Grub-bios-setup: warning: your core.img is unusually large

Problem:

Update of grub(2) fails with the following error message:

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

This might happen if the space before the first partition on the hard disk is too small to fit the Master Boot Record (512 byte) and the grub core.img (/boot/grub/*/core.img). In general the core.img is very small but additional modules need to be added which increase the size of the image when software RAID and LVM is in use.

Solution:

Because of the variety of possible setups there is no universal way of fixing this but in most cases the first partition on each hard disk is used as /boot partition or as mdadm RAID partition holing an MD for /root.

In this case the easiest workaround would be to recreate the first partition (slightly smaller) to gain some space for the core.img.

Please be aware that these steps are only provided as an example and might not fit your setup! It assumes that you have created a mdadm software RAID 1 (md0) over the first partition of two disks (sda1 and sdb1) holding the filesystem for /boot.

Mistakes or errors may lead to unrecoverable data loss! Please read and adapt all steps carefully and check the output of every command for possible error messages!

Backup /boot data:

rsync -AHaX /boot/ /root/boot_backup

Delete md0:

umount /boot
mdadm --stop /dev/md0
mdadm --remove /dev/md0
mdadm --zero-superblock /dev/sda1 /dev/sdb1

Delete and recreate the partitions sda1 and sdb1 starting at 1MB.

Rebuild the raid and filesystem:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mkfs.ext3 -m0 /dev/md0

Update ARRAY definitions in /etc/mdadm/mdadm.conf using output of:

mdadm --detail --scan

Restore /boot data:

mount /boot
rsync -AHaX /root/boot_backup/ /boot

Update grub configuration:

update-grub2
(Re)-Install grub:
grub-install /dev/sda
grub-install /dev/sdb

Update initrd:

update-initramfs -kall -u

When all steps completed successfully, please ensure that you are still able to boot the system!

Mastodon