Skip to content

Instantly share code, notes, and snippets.

@Programator2
Last active September 16, 2024 19:13
Show Gist options
  • Save Programator2/50917a60c421230d3ae282c5da982e34 to your computer and use it in GitHub Desktop.
Save Programator2/50917a60c421230d3ae282c5da982e34 to your computer and use it in GitHub Desktop.
This gist shows how to recover Windows 10 boot problems after cloning a harddrive (error code 0xc000000e)

Prerequisites

This guide applies to UEFI systems with GPT drives. It was tested on Windows 10 April 2018 edition, but it should also work on Windows 8 and newer releases (maybe even 7).

The problem

Occurs after an original drive from which the system drive was cloned is connected to the system at boot.

Error code 0xc000000e with message The boot selection failed because a required device is inaccessible.

Sometimes, after pressing ENTER, message changes into The application or operating system couldn't be loaded because a required file is missing or contains errors: \WINDOWS\System32\winload.efi with the same error code.

No option presented on the screen worked.

More info

This problem occurred to me after I cloned my HDD to SSD. Process of cloning using dd on Linux was successful and system worked correctly (funnily enough, the problem occurred 3 months after I cloned the hard drive as I wanted to use the original HDD as a backup external drive). Problem occurred after I changed the ntfs serial numbers of partitions on the original HDD (using the ntfslabel command with --new-half-serial option). Serials were successfully changed and I rebooted from live Linux distribution into Windows 10. The main mistake --- I left the HDD connected. Windows boot screen contained message similar to "Preparing to repair". I didn't disconnect the HDD and Windows repaired itself into a boot loop.

One thing is for sure --- Windows somehow changed the boot records to point somewhere else (presumably on the now external HDD. Looking back, I think using --with-half-serial was the main culprit.

Solution

This guide assumes you have a Linux bootable flash drive. You can find many guides on how to create one on the Web. I recommend choosing an Ubuntu flavored distribution because of software we'll be using. I used Lubuntu 18.04 LTS.

  1. Download Windows 10 ISO (https://www.microsoft.com/software-download/windows10). Ideally, choose the version you currently have --- in my case, the April 2018 edition. But newer versions should work just as fine.

  2. Install WoeUSB:

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt update
sudo apt install woeusb
  1. Format partition on the flash drive to NTFS (GParted is the most comfortable tool for this).

  2. Start up WoeUSB and load the image onto the flash drive.

For more detailed description see the source of the first part of this guide: https://itsfoss.com/bootable-windows-usb-linux/

  1. Boot from the prepared flash drive.

  2. Go into Windows recovery CMD

  3. Run diskpart. You need to list volume to find the EFI volume and your system volume with Windows.

First, find the system volume --- this is where Windows is installed. It usually has OS label. Remember its volume letter. In my case it was D. Don't be fooled by that it's not C.

Then find the EFI volume --- it usually doesn't have a letter assigned, it's around 300 MB long and has label SYSTEM. Use select volume X to select it (change X into the correct number). Then assign letter=w (or any other unused letter) and exit the diskpart tool.

  1. Finishing up, type this command:
bcdboot d:\windows /s w: /f UEFI /v

where d is your Windows volume and w is your EFI Volume. I specified UEFI just to be sure and used /v for verbose to get more output (who doesn't want to get more information about such delicate operation?)

  1. Type exit into console and turn off the computer. Remove all removable devices and turn on the computer. After a round of automatic chkdsk checking, it should boot up correctly.

  2. If everything worked correctly, you can wipe the sweat from your forehead.

@zabanet
Copy link

zabanet commented Jun 10, 2021

Thanks! It worked. Only thing I had to change is letter casing in assign letter=w command. It matters to write LETTER uppercase because otherwise it doesn't understand the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment