×


Repair EFI GPT Bootloader on Windows 10

Need to repair EFI/GPT bootloader on Windows 10 ?

This guide is for you.


EFI files are UEFI boot loaders and here's how they work

A file with the EFI file extension is an Extensible Firmware Interface file. They are boot loader executables, exist on UEFI (Unified Extensible Firmware Interface) based computer systems, and contain data on how the boot process should proceed.


Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to fix Windows related errors.

In this context, we shall look into the steps to repair bootloader on Windows.


How to repair EFI/GPT bootloader on Windows 10 ?

Here, we shall see how to repair the Windows bootloader that uses UEFI instead of BIOS and GPT disk partition table. This is useful if Windows does not boot due to missing or damaged boot configuration file \EFI\Microsoft\Boot\BCD.

The corruption of the Windows bootloader might occur after installing a second OS. It may occur due to incorrect actions during Windows recovery, removal of some data on hidden partitions, malicious software (virus, ransomware, etc.) and for some other reasons.


The boot configuration data for your PC is missing: EFI\Microsoft\Boot\BCD ?

A computer with Windows 10 installed in native UEFI mode might fail to boot if the EFI bootloader is corrupted. 

When trying to boot the computer, the following BSOD error appears:

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

or

Error code: 0xc000014c

Here, the error indicates that the Windows bootloader configuration – Boot Configuration Data is corrupted or even completely removed. However, if we try to repair the bootloader on a UEFI computer using the bcdedit tool, we will receive an error as below:

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

Actually, the fact is that if Windows 10 is installed in native UEFI mode on a GPT disk. Then the Windows 10 EFI bootloader (Windows Boot Manager) stores the boot manager and BCD configuration on a separate hidden EFI volume. The bcdedit tool does not see this EFI partition, and cannot manage the bootloader configuration on it.


In case, if the computer boots with a black screen with the message "Operating System not found" then it means that the Windows bootloader is completely removed.


Automatic Windows Bootloader Recovery ?

The procedure for the automatic repair of the bootloader used in the Windows Recovery Environment (WinRE), is generally of no great use in such cases. 

But anyway it is worth trying.

Do the following;

i. First, we try to boot the device from the recovery disc or install Windows 10 media.

ii. Next, on the installation screen, we click the Restore System.

iii. Then we select Troubleshoot >> Startup Repair and we select the OS whose bootloader we want to try to recover.

iv. However, most likely the result will be negative: Automatic Repair couldn’t repair your PC.


Using BCDBoot to Manually Repair EFI Bootloader in Windows 10 ?

Now let us see how to manually restore the EFI Windows bootloader.

To repair the bootloader configuration, we have to boot from the original installation of Windows 10 media. After booting into the recovery environment, we open a command line: select System Restore >> Troubleshoot >> Command Prompt.


In the command prompt, we run the disk management tool:

diskpart

Then we display the list of drives:

list disk

Now we select the disk with Windows installed (if there is one hard disk in the system, its index should be 0):

sel disk 0

We display list of partitions and volumes on the disk.

list partition
list volume

In this example, we see that the EFI boot partition has the partition 2 index (aka Volume 5 with the Hidden label). The main partition with the installed Windows with the NTFS file system is volume 2. Also, there is an MSR partition of 16 MB for Windows 10 (or 128 MB for Windows 8.1).


Then we assign the drive letter K: to the hidden EFI volume:

select volume 1
assign letter K:

As a result, the below message will appear:

DiskPart is successfully assigned the drive letter or mount point.

Now, we close diskpart:

exit

Then we go to the bootloader directory on the hidden volume:

cd /d K:\efi\microsoft\boot\

In this case, K: is the drive letter assigned to the EFI partition. If the \EFI\Microsoft\Boot\ directory is missing (error The system cannot find the path specified), then we try the following commands:

cd /d K:\Boot\

or

cd /d K:\ESD\Windows\EFI\Microsoft\Boot\

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

attrib BCD -s -h -r

In order to delete the current BCD configuration file, we rename it by running the below command(this will keep the old boot configuration as a backup).

ren BCD BCD.bak

Then using the bcdboot.exe utility, we recreate the BCD store by copying the UEFI boot environment files to the boot partition from the Windows directory:

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

Now, if we run the bcdedit command, we will see the following:

An entry should appear in the Windows Boot Manager section containing the full path to the UEFI boot file (\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI). In this example, it is located on volume 2 (partition=\Device\HarddiskVolume2).

Possible errors in Windows:

1. BFSVC Error: Could not open the BCD template store. status – [c000000f] 

We check if the entered command is correct and whether you have a localized Windows version installed. In this case, we should specify the correct local language code. The bcdboot tool copies the BCD template files from the \Windows\System32\Config directory. If the BCD templates in this folder are damaged or deleted, try to check the integrity of the system files offline using the sfc.exe tool (you need a Windows installation disc – drive D :):

sfc /scanow /OFFBOOTDIR=C:\ /OFFWINDIR=D:\WINDOWS

 2. BFSVC Error: Error copying boot files from Last Error = 0x570

We try to check the drive with the help of the below command:

CHKDSK K: /F

3. BFSVC Error: Failed to set element application device. Status = [c000000bb]

We check the EFI and Windows 10 partitions with chkdsk.exe. Verify that the hidden and system attribute of the BCD file is cleared. We remove it:

attrib -s -h \EFI\Microsoft\Boot\BCD
del \EFI\Microsoft\Boot\BCD
bcdboot: bfsvc error

 4. Failure when initializing library system volume

We make sure you are using the correct FAT32 partition with EFI (you may have several similar partitions).

Finally, now we restart the computer and disconnect the bootable media. Then the Windows Boot Manager appears in the list of bootable devices, where we can choose the desired operating system to boot. Your EFI bootloader and BCD configuration have been restored successfully!


[Need urgent assistance with Windows queries? – We are here to help you. ]


Conclusion

This article will guide you on different methods to repair #EFI / #GPT #bootloader on the #Windows server. You can use Use #diskpart #command.