5

When trying to resurrect my (t)rusty 'ol router who's system disk (CF card) had failed (probably because I neglected to tune Ubuntu properly for this type of media), I wanted to use the opportunity to install 12.04 server using BTRFS for the entire CF card. BTRFS can supposedly be better tuned towards flash disks so I figured this would be a good idea. So I swapped the defective CF card with a new one and booted from the 12.04 server CD.

Although the installation went painfully slow ( > 3 hrs), I already read this is a known issue when using BTRFS on flash disks so I did not worry that much.

However, when the setup process was finally at the point where GRUB was going to be installed, I got the following error:

Unable to install GRUB in /dev/sda
Executing 'grub-install /dev/sda' failed.

This is a fatal error.

This is what I saw when I switched back to TTY4:

grub-installer: info: Installing grub on '/dev/sda'
grub-installer: info: grub-install supports --no-floppy
grub-installer: info: Running chroot /target grub-install --no-floppy --force "/dev/sda"
grub-installer: /usr/sbin/grub-setup: warn:
grub-installer: 
grub-installer: Your core.img is unusually large. It won't fit in the embedding area.
grub-installer: .
grub-installer: /usr/sbin/grub-setup: warn:
grub-installer: 
grub-installer: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However blocklists are UNRELIABLE and their use is discouraged.
grub-installer: .
grub-installer: /usr/sbin/grub-setup: error:
grub-installer: 
grub-installer: cannot read '/@/boot/grub/core.img' correctly
grub-installer: .
grub-installer: error: Running 'grub-install --no-floppy --force "/dev/sda"' failed.

I then tried to install GRUB to /dev/sda1 instead, which worked without errors. However, when I now boot the system, I get the infamous 'GRUB Error 17'.

So my obvious question is - how do I fix this? And is this a bug in the installer that I need to report? As you can imagine, I would prefer not to have to spend another 3 hours doing the entire installation again...

Edit: I took a quick look at the size of core.img, and it's 38284 bytes. If I understood correctly, GRUB wants to put this at the very first position on the disk, where a tiny amount of space should be available before the first partition. In my case this space is, if I interpreted the data of 'fdisk -l /dev/sda' correctly, only 63 x 512 = 32256 bytes in size... no wonder GRUB complains about core.img not fitting in!

But how can it be core.img is this large? Is it because of BTRFS? For example, the core.img of my laptop is only 26052 bytes (and it's not using BTRFS). How do I get it to fit, besides reformatting to something else than BTRFS?

Edit 2: Feeling courageous, I used gparted to move sda1 a little 'to the right', to enlarge the space before the first partition. After this, I booted the 12.04 server CD in resque + expert mode and tried to install GRUB again. This time I got a different error:

grub-installer: /usr/sbin/grub-probe: error:
grub-installer:
grub-installer: cannot find a device for /boot/grub (is /dev mounted?)
grub-installer: .
grub-installer: error: Running 'grub-install --no-floppy --force "/dev/sda"' failed.

Now what?

2
  • 1
    The current “optimum” offset for the first partition is 2048 sectors or 1 Mebibyte. How precisely are you trying to install GRUB from the CD? Can you use the bootloader on the CD, for example, to boot the installed system, then try to reinstall GRUB from it?
    – mirabilos
    Dec 6, 2013 at 15:13
  • 1
    mirabilos, thanks for commenting. It's been well over a year since I ran into this problem. I'm not entirely sure how I eventually fixed the problem, but seeing that the system now uses ext2 I figure I gave up in the end and re-installed the whole thing using ext2 instead of btrfs.
    – iGadget
    Dec 10, 2013 at 11:01

1 Answer 1

2

grub+btrfs module is too big for the free space in your MBR, see bug #1059827 - "Non trivial grub2 installs no longer fit in small embed areas".

Not the answer you're looking for? Browse other questions tagged .