Recover windows 10 EFI Boot from dual boot with ubuntu

I made my window 10 system system in dual boot with ubuntu. I would like to remove ubuntu and install it in virtual-box within windows.

I am afraid to remove ubuntu partions fearing windows may not boot after it. Currently I get ubuntu Grub screen on booting computer. How do I get my windows bootloader back so that I don't see grub screen again. Once I am able to do that I can delete ubuntu partions and merge it back with windows partitions.

Please help to get me my windows bootloader back.

Thanks :)


Solution 1:

Before you uninstall Ubuntu, you should do one or both of two things:

  • Remove GRUB's files -- On an EFI-based computer, GRUB lives on the EFI System Partition (ESP), which is mounted at /boot/efi in Ubuntu. Ubuntu stores GRUB in the EFI/ubuntu directory on this partition, so you can remove it by typing sudo rm -rf /boot/efi/EFI/ubuntu in Ubuntu. This will not affect the currently-running Ubuntu, but once you shut down, you will be unable to reboot into Ubuntu! (If you change your mind at this point, you can re-install GRUB or some other boot loader in any of several ways.)
  • Move Windows to the top of the EFI's boot list -- Instead of (or in addition to) removing GRUB, you can alter the EFI boot order. There are several ways to do this, including:
    • efibootmgr in Ubuntu -- You can type sudo efibootmgr to see the BootOrder variable and all the Boot#### entries to which it refers. You can then alter the BootOrder variable by using the -o option, as in sudo efibootmgr -o 4,2,A to set the system to try Boot0004 first, followed by Boot0002 and then Boot000A. The appropriate order depends on what's entered in the current list, so you should not simply use 4,2.A; that's just an example.
    • EasyUEFI in Windows -- The third-party EasyUEFI tool does the same thing that efibootmgr does, but with a GUI. Thus, you can delete the ubuntu entry or move it down the list of priorities.
    • Your firmware -- Some, but not all, EFIs enable you to adjust the boot order from their own user interfaces. You'd hit Delete, Enter, or a function key to enter the setup utility, find the option to adjust the boot order, and do so in whatever way the firmware supports. Unfortunately, there's no standardization of this, so I can't be more precise in how to do it. In fact, as I've already mentioned, not all EFIs provide this functionality.

With the exception of using the firmware, it's best if you do this before you delete the Ubuntu partition. If you delete the Ubuntu partition first, you're likely to get a grub> prompt when you boot. If that happens, exiting from GRUB or using the computer's built-in boot manager may enable you to boot to Windows, whereupon you can delete the GRUB files or use EasyUEFI to recover permanently.