Recovering the Windows 10 EFI bootloader after a Linux installation requires mounting the EFI System Partition and using bcdboot to restore the boot files. This process ensures that the UEFI firmware can locate the Windows Boot Manager again, allowing you to dual-boot both operating systems without losing access to your primary Windows environment.
Understanding the EFI Structure
When you install Linux on a system with an existing Windows 10 setup, the installer typically modifies the EFI System Partition (ESP). This partition is a FAT32 formatted drive that stores bootloader code for all installed operating systems. The Linux installer often creates its own directory or overwrites the existing \EFI\Microsoft\Boot folder, which causes the system to fail when trying to start Windows directly from the UEFI menu.
The key to recovery lies in understanding that the ESP contains separate folders for each OS. For Windows, this is located at \EFI\Microsoft\Boot. For GRUB, it might be at \EFI\ubuntu or \EFI\debian. When the Windows boot files are missing or corrupted in their designated folder, the UEFI firmware cannot find the necessary binaries to launch the Windows kernel. Restoring these files does not affect your Linux installation; it simply places the correct Windows boot components back into their expected location within the shared partition.
Accessing the Recovery Environment
To begin the repair process, you need access to a Windows command prompt with administrative privileges. If your system no longer boots into Windows, you must create a Windows 10 installation media using another computer. Use the Media Creation Tool from Microsoft to write the ISO to a USB drive. Boot your affected PC from this USB drive by selecting it in the UEFI boot menu.
Once the Windows Setup screen appears, select your language preferences and click Next. Instead of clicking Install Now, look for the link in the bottom left corner labeled Repair your computer. Navigate to Troubleshoot, then Advanced options, and finally Command Prompt. This opens a specialized environment where you have access to the low-level tools required to manipulate the EFI partition. If you are already booted into a working Windows session, open the Start menu, type cmd, right-click Command Prompt, and select Run as administrator.
In some cases, users may prefer to use a Linux live USB to perform the initial file inspection before switching to Windows tools. However, using the native Windows recovery environment is generally safer for writing the bcdboot commands, as it ensures compatibility with the Windows Boot Manager structure. This step is crucial because incorrect manual edits to the EFI variables can render both operating systems unbootable. For more complex software issues, refer to our comprehensive troubleshooting guide for additional diagnostic steps.
Identifying the Correct Drives
Before running any repair commands, you must identify which drive letter corresponds to your EFI System Partition and which drive letter represents your Windows installation. In the recovery environment, drive letters often differ from those in a normal Windows session. The EFI partition usually does not get a drive letter automatically assigned, so you must assign one manually.
Type diskpart and press Enter to launch the DiskPart utility. Inside DiskPart, type list vol to display all volumes. Look for a volume that is approximately 100-500 MB in size and has a file system of FAT32. This is your EFI System Partition. Note its volume number. Then, type select vol X (replacing X with the volume number) and assign letter=S to give it the temporary letter S. Type exit twice to close DiskPart and return to the command prompt.
Next, identify the Windows partition. It is typically the largest NTFS volume. You can verify this by checking the drive letters. Let us assume your Windows partition is assigned the letter C: and your newly assigned EFI partition is S:. These identifiers are critical for the next step. If you are unsure about the exact layout, consult our article on recovering GRUB EFI for dual boot setups to understand how partitions interact in a mixed environment.
Restoring the Boot Files
With the correct drive letters identified, you can now regenerate the Windows boot files. The most reliable method uses the bcdboot utility, which copies the necessary boot files from the Windows system directory to the EFI partition and creates a new boot store entry.
Type the following command exactly:
bcdboot C:\Windows /s S: /f UEFI
Here, C:\Windows points to your Windows installation directory, /s S: specifies the target EFI partition, and /f UEFI forces the creation of UEFI-compatible boot files. If your Windows installation is on a different drive letter, adjust the path accordingly. After executing this command, you should see a message stating "Boot files created successfully."
This action restores the \EFI\Microsoft\Boot\bootmgfw.efi file and updates the NVRAM entries. It effectively tells the motherboard's UEFI firmware where to find the Windows bootloader again. Once completed, type exit to close the command prompt and restart your computer. Remove the installation USB if you are still booted from it.
Verifying and Setting Defaults
After rebooting, enter the UEFI setup utility (usually by pressing F2, Del, or F12 during startup). Check the boot order to ensure that "Windows Boot Manager" is listed. If it is not visible, the EFI partition may not have been mounted correctly, or there may be a deeper issue with the partition table. If you want Linux to be the default boot option, you can change the priority in the UEFI settings or use the efibootmgr command from a Linux terminal.
If you successfully restored Windows but lost your GRUB menu, you can reinstall GRUB from a Linux live USB. Mount the EFI partition and copy the Ubuntu or Debian folder back if it was accidentally deleted. For guidance on setting the default EFI entry after such reboots, see our guide on setting default EFI after rebooting Windows.
Frequently Asked Questions
Will restoring the Windows bootloader delete my Linux installation?
No, using bcdboot only writes files to the EFI System Partition and does not touch the Linux root partition or data. Your Linux files remain intact. However, the GRUB bootloader configuration might need to be updated separately if it was overwritten during the initial Windows repair process.
What if I cannot see the EFI partition in DiskPart?
If the EFI partition is hidden, ensure you are looking for the FAT32 volume with a small size (typically 100-500 MB). If it still does not appear, the partition might be marked as inactive or corrupted. In such cases, you may need to use third-party partition managers or check the disk integrity with chkdsk before attempting repairs.
Can I use the Linux terminal to fix the Windows bootloader?
While you can manually copy files, it is highly recommended to use the Windows bcdboot tool. Manually creating the BCD store from Linux is complex and error-prone. Using the native Windows tool ensures that the boot manager entries are registered correctly in the UEFI NVRAM.
Why does my system still boot into GRUB after fixing Windows?
This is likely due to the UEFI boot order prioritizing the Linux bootloader over Windows Boot Manager. You can change this in your BIOS/UEFI settings by moving "Windows Boot Manager" to the top of the boot priority list. Alternatively, you can configure GRUB to chainload Windows.
Is it safe to run bcdboot multiple times?
Yes, running bcdboot multiple times is safe. It will overwrite existing boot files with fresh copies and update the boot store. This is useful if previous attempts failed or if the boot files were partially corrupted. Always ensure you are pointing to the correct source Windows directory and target EFI partition.