Ubuntu – How to boot Windows 8 from a legacy MBR partition in UEFI mode via GRUB

grub-efiuefiwindows 8

This question is similar to the answer
of Dual-boot Ubuntu 12.10 on UEFI along Windows 8 (GRUB – error: can't find command drivemap), but Windows 8 is installed on a legacy partitioned drive.

What steps need to be performed to make the installation boot in UEFI mode without converting to GPT or using DISM?

I know that it is generally not recommended to mix UEFI and legacy booting, but it can be handy in some setups.

Best Answer

Yes, it is possible to boot Windows 8 in UEFI mode, even if you installed it on a legacy partitioned disk (MS-DOS/MBR). Of course you would need a UEFI compatible GRUB installation on another GPT partitioned disk.

  1. In Windows, install a new boot configuration to volume C: by running the following command:

    bcdboot C:\Windows /s C: /f uefi
    

    When booted in UEFI mode this will not only create a new boot configuration in C:\EFI\ but also register a new UEFI bootloader in NVRAM. You can remove the entry later with efibootmgr in Ubuntu (for instructions see: How do I remove "Ubuntu" in the bios boot menu? (UEFI)).

    Of course you can also choose another location, but this method should be the easiest. For more details on bcdboot see the corresponding Microsoft Technet article.

  2. In Ubuntu, add a custom GRUB menu entry by adding the following lines to /etc/grub.d/40_custom:

    menuentry "Windows 8 (BCD-UEFI configuration on system drive /dev/sda2)" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        insmod search_fs_uuid
        insmod chain
    
        set root='hd0,msdos2'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  2ACC7043CC700B79
        else
          search --no-floppy --fs-uuid --set=root 2ACC7043CC700B79
        fi
    
        chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    }
    

    Note that you will need to edit the following parameters if your configuration differs:

    • This entry is configured to boot from the 2nd partition (msdos2) of the 1st hard drive (hd0 or ahci0).
    • You also need to replace the filesystem UUID (2ACC7043CC700B79) with yours. In this example you could run sudo blkid /dev/sda2 to get the UUID or start GParted.
    • Reminder: This example deals with a drive that has a legacy partition table. If yours is GPT, then replace msdos with gpt.
  3. Finally run sudo update-grub to generate the new configuration.

Answer moved from https://askubuntu.com/q/377807/40581 as it looked out of place there.

Related Question