Dual-boot Ubuntu 12.10 on UEFI along Windows 8 (GRUB - error: can't find command drivemap)

Solution 1:

I found a temporary solution.

Add a custom entry to GRUB bootmenu

Append the code below to /etc/grub.d/40_custom.

menuentry "Windows 8" {
    insmod part_gpt
    insmod chain
    set root='(hd0,gpt1)'
    chainloader /EFI/microsoft/BOOT/bootmgfw.efi
}

You can use Ctrl+Alt+T to open a terminal and run sudo nano /etc/grub.d/40_custom, then copy and paste the code. Finally then press Ctrl+O to save and Ctrl+X to leave.

Heads up: hd0,gpt1 here is the ID of my EFI System Partition (ESP). If your ESP is not the first partition on your first harddrive during boot, then yours is different! E.g. hd1,gpt2 for the second partition on the second drive.

Replace part_gpt with part_msdos if the drive uses MBR and legacy partitioning and also change hd0,gpt1 to hd0,msdos1 respectively.

Apply changes to GRUB

Simply run the following command, which should generate a new GRUB configuration, including the new custom entry:

sudo update-grub

Now reboot, you should be able to boot Windows 8 now. If not, and Windows complains about corrupted BCD configuration, then continue on superuser: How can I repair the Windows 8 EFI Bootloader?


Warning: On some occasions, if you boot Windows 8, GRUB will be replaced by Windows Boot Manager as default boot manager.

Solution 2:

The wrong Windows entries in GRUB are due to this bug: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1024383

Solution: run Boot-Repair's Recommended Repair from a liveCD (or liveUSB).