Fixing the boot files in UEFI partition for a Windows 10 installation a straightforward process, but it does require a few steps to complete. In this blog post, we’ll go over the steps needed to fix the boot files in th UEFI partition for booting Windows 10.
Before we begin, you’ll need a bootable Windows 10 recovery USB (see here for instructions on how to create them on Linux).
Once you have everything ready, let’s start the process.
- Insert the Media (DVD/USB) in your personal computer and restart.
- Boot from the media.
- Select Repair Your Computer.
- Select Troubleshoot.
- Select Advanced Options.
- Choose Command Prompt from the menu:
- Type and run the command:
diskpart
- Type and run the command:
select disk 0
- Type and run the command:
list vol
- Type and run the command:
- Verify that the EFI partition (EPS - EFI System Partition) is using the FAT32 file system.
Assign a drive letter to it that is not already in use:
- Type and run the command:
select vol <number of volume>
- Type and run the command:
assign letter=<drive letter>
- Type and run the command:
exit
- Type and run the command:
- Repair the boot record:
- Type and run the command:
cd /d <drive letter>:\EFI\Microsoft\Boot\
- Type and run the command:
bootrec /FixBoot
- Type and run the command:
bcdboot C:\Windows
- Type and run the command:
Notice: this is an adjusted version of the related instructions from Dell provided here.
This process will also change the default UEFI boot priority order to automatically boot Windows 10.
This UEFI boot priority order can be adjusted from the linux command line.
The process requires the efibootmg tool.
In NixOS this can be installed into a nix-shel via the command: nix-shell -p efibootmgr
.
To change the UEFI boot priority perform the following steps:
- Displaying Current Settings
Simply run the following command:efibootmgr
.
This command allows you to view the default boot entry (BootCurrent), boot order and all boot entries. Each boot entry is identified by a boot number in hexadecimal. The asterisk (*) means the boot entry is active. - Changing Boot Order
First, copy the current boot order.
Then type in the following command:sudo efibootmgr -o 0003,0000,0001,0002
and change the boot order as desired (in this example item 0003 is moved to the front of the ordered list).
Ensure that all boot items are present in the list final list.
More information about UEFI boot item managemet from Linux, see here.