How to Repair EFI/GPT Bootloader on Windows 10 or 11

SITUATION

A UEFI computer with Windows installed in native mode will not be able to boot if the Windows EFI bootloader is corrupted. When trying to boot from a disk with a damaged or missing EFI bootloader, the following BSOD (Blue Screen of Death) error appears:

The boot configuration data for your PC is missing or contains errors.
File :\boot\bcd
Error code: 0xc000000f

boot fail

or:

Error code: 0xc000014c
Error code: 0xc0000098

This error indicates that the Windows bootloader configuration (Boot Configuration Data, BCD) has been corrupted or even completely removed. If you try to repair the bootloader on a UEFI computer using bcdedit tool, you will receive an error:

The boot configuration data store could not be found.
The requested system device cannot be found.

If Windows 10/11 is installed in native UEFI mode on a GPT disk, then the Windows EFI bootloader (Windows Boot Manager) stores the boot manager and BCD configuration on a separate hidden EFI volume (100 MB in size with the FAT32 file system). The bcdedit tool doesn’t see this EFI partition, and cannot manage the bootloader configuration on it.

Using Automatic Repair

Boot your device from the recovery disc or Windows 10/11 installation media.
Then select Repair your computer –> Troubleshoot -> Startup Repair and select the OS whose bootloader you want to try to repair:

startup repair

But most likely the result will be negative: Automatic Repair couldn't repair your PC.

Using BCDBoot to Manually Repair EFI Bootloader

To repair the bootloader configuration (BCD), you have to boot from the original Windows installation media.
After booting into the recovery environment, select Repair your computer –> Troubleshoot -> Command Prompt to open a command-line console:.

command prompt

You can run the Command Prompt even if you only have a Windows installation media at hand. To do this, it is enough to press the key combination Shift + F10 (or Shift + Fn + F10 on some laptop models) on the first Windows setup screen (when choosing a language and keyboard layout).

In the command prompt that opens, run the disk management tool, display the list of drives on the computer:

DISKPART> list disk

list disk

If the asterisk (*) is in the Gpt column, then the GPT partition table is used on disk. If not, the MBR is used.

Select the drive where your Windows is installed (if there is only one hard drive in the system, its index should be 0), display the list of partitions and volumes on this disk:

DISKPART> sel disk 0
DISKPART> list partition
DISKPART> list volume

EFI boot partition

In this example, you can see that the EFI boot partition has the partition 2 index (aka Volume 5 with the Hidden label). And the main partition on which Windows is installed has a volume 2 index, is formatted in the NTFS file system, and is assigned the drive letter C:.

Assign the drive letter K: to the hidden EFI volume:

DISKPART> select volume 5
DISKPART> assign letter K:
DISKPART> exit

Go to the bootloader directory on the hidden volume:

X:\Sources>  cd /d K:\efi\microsoft\boot\

You need to use the BCDBoot.exe tool to restore bootloader files and fix the boot records on the EFI partition by copying them from the system directory on the Windows partition. The BCD bootloader configuration is recreated using the %WINDIR%\System32\Config\BCD-Template file.

Use the attrib command to remove the hidden, read-only, and system attributes from the BCD file:

X:\Sources> attrib BCD -s -h -r

Delete the current BCD configuration file by renaming it (this will keep the old boot configuration as a backup):

X:\Sources> ren BCD BCD.bak

Using the bcdboot tool, you need to copy the critical files of the UEFI boot environment from the system directory to the EFI boot partition and recreate the BCD bootloader config file:

X:\Sources> bcdboot C:\Windows /l en-us /s k: /f ALL

Now, you can run the bcdedit command to show windows boot manager information.