Wednesday, November 28, 2012

Fix: New Install of Ubuntu 12.10 Won't Boot

I recently installed Ubuntu 12.10 on my Dell Lattitude work laptop, dual booting with Windows 7. Though the install was successful, the system then booted to the GRUB rescue prompt, with the message:

error: file '/boot/grub/i386-pc/normal.mod' not found.

After re-installing several times, and a couple hours of finding nothing on Google. I found the solution  here. It appears the problem was caused by the Ubuntu installer, which installed the GRUB for EFI bootloader instead of the standard version.

I won't go into the whole EFI secure boot controversy, as it's been abundantly covered elsewhere. My laptop is secure boot capable, but this feature had already been disabled when I received it. However, Ubuntu still installed the secure boot version of GRUB, apparently because it detected that my system had EFI capability.

So, and I'm guessing here, that when the laptop started to boot, the BIOS transferred control to GRUB, which tried to boot as it would for a non-EFI system. However, because the wrong variant of GRUB was installed, it was unable to find the necessary files to complete the boot process. GRUB thought it was on a non-EFI system, but the Ubuntu installer hadn't installed the necessary files for a non-EFI boot.

The solution: boot the live DVD, mount the root partition, and re-install grub with --root-directory flag set. Example:

# mount /dev/sda5 /mnt

# grub-install /dev/sda --root-directory=/mnt

This mounts the root partition (assuming it's on /dev/sda5), and then installs grub to the drive's master boot record. Passing it the path to the root directory will cause grub to install it's files into the "boot" directory in that path; in this case "/mnt/boot".  This will install the non-EFI version of GRUB, and the system will then boot normally.

I admit that my understanding of what caused the problem isn't totally clear, so feel free to correct me in the comments.

Incidentally, I installed Fedora 17 on the same laptop, with device encryption set, and experienced no issues. IMHO, Fedora's installer makes Ubuntu's look like a CS class project. I just wish the installed system worked as well. I've long found the Ubuntu installer to have an unpredictable outcome.