Ubuntu – GRUB: “invalid arch independent ELF magic” after install on SSD


I've got a brand new laptop with a 128GB SSD drive. I read that aligning the partitions to match the Erase Block Size of the SSD is important. I followed William Scott's guide SSD Tweaks in Linux and Aligning Partitions and my partitions ended up being:

$ sudo fdisk -lu /dev/sda

Disk /dev/sda: 128.0 GB, 128035676100 bytes
32 heads, 32 sectors/track, 244208 cylinders, total 250069680 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: 0x00037bd2

   Device Boot       Start        End     Blocks   Id  System
/dev/sda1   *         1024     206847     102912   83  Linux
/dev/sda2           206848   16985087    8389120   82  Linux swap / Solaris
/dev/sda3         16985088  250068991  116541952   83  Linux

Then I installed Ubuntu Natty and specified the partitions manually so that /dev/sda1 became the /boot partition formatted with ext2, /dev/sda2 the swap and /dev/sda3 the / formatted with ext4. After the installation the thing didn't boot, and I ended up in the grub-rescue console which doesn't make any sense to me. It's giving me:

error: invalid arch independent ELF magic.
grub rescue>

Have I done some mistakes during my installation? How do I solve the issue with grub-recovery?

Best Answer

Boot into Live CD and run:

sudo mount /dev/sda3 /mnt
sudo mount /dev/sda1 /mnt/boot
sudo grub-install --root-directory=/mnt /dev/sda