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

23,447

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.

Share:
23,447

Related videos on Youtube

Csabi Vidó
Author by

Csabi Vidó

This is my AskUbuntu profile and most of my stuff here on StackExchange is tech-oriented. However I do have other hobbies and interests, you may find more about these in my other profiles on the network. I'm lwbt on Reddit and Telegram. I started with Ubuntu and Linux somewhere between 2006 and 2007. With the release of 08.04 I completely migrated away from Windows to Ubuntu and while this has been a few years ago I still consider myself fairly new to this topic and I know I can still discover something new and exciting everyday. The following listing is not to brag about hardware, I'm rather trying to reproduce issues and share experience. Custom built desktop computers with Intel HD graphics (dualscreen setup), Lenovo T530 & T560 (touch) without discrete graphics (also run Windows 10), Chromebooks Lenovo N22 & ASUS Flip C302 (with GalliumOS) Behringer FCA610 USB (PulseAudio multichannel configuration), JDS Labs C5D & The Element, Bluetooth dongles and BT audio speakers and headphones Wacom Intuos 4 PTK-540WL HP 3005pr Port Replicator (works with proprietary DisplayLink driver) Aten CS1794 HDMI KVMP Switch Logitech TK820 and some unifying receiver mice …and some APC UPS

Updated on September 18, 2022

Comments

  • Csabi Vidó
    Csabi Vidó over 1 year

    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.

  • Daniel
    Daniel almost 7 years
    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.
  • Artem P
    Artem P about 4 years
    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.
  • Winter
    Winter almost 4 years
    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.
  • nobjta_9x_tq
    nobjta_9x_tq almost 4 years
    the hardest thing I has been passed because you bro!