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.

LiveWireBT
  • 28,763

1 Answers1

8

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.

LiveWireBT
  • 28,763
  • The custom GRUB entry isn't needed (at least not for windows 10's boot manager), you can install to the BCD to your main EFI partition, with "bcdboot C:\Windows /s X: /f UEFI", where X is the letter you assigned to the UEFI partition. You can assign a letter to the UEFI partition either using the windows gui or using "diskpart" command line utility. This works even if windows isn't in a GPT partition. – Daniel May 11 '17 at 20:40
  • Wow, this one bcdboot C:\Windows /s C: /f uefi is only what worked for me. Other answers suggest to reinstall Windows. Btw menu entry works with only search --no-floppy --fs-uuid --set=root 2ACC7043CC700B79 and chainloader /EFI/Microsoft/Boot/bootmgfw.efi other lines is not necessary. – Artem P Apr 03 '20 at 20:42
  • 1
    Note that if you are on windows 7, the /f option may not be there. I downloaded bcdboot.exe from Windows 8 online and run the command from the downloaded exe. It worked. – Winter May 10 '20 at 15:10
  • the hardest thing I has been passed because you bro! – nobjta_9x_tq Jun 11 '20 at 17:49