Skip to content

Instantly share code, notes, and snippets.

@hemenkapadia
Created May 7, 2018 08:11
Show Gist options
  • Save hemenkapadia/8acc7b2ff97acfc906dc3b0fda22553f to your computer and use it in GitHub Desktop.
Save hemenkapadia/8acc7b2ff97acfc906dc3b0fda22553f to your computer and use it in GitHub Desktop.
Ubuntu - Recovering Windows boot when GRUB fails loading
Installing Ubuntu 18.04 resulted in an error with the Ubiquity process crashing while copying files. As a result files possibly were not copied on the drives as intended.
I tried following the GRUB recovery process mentioned at https://www.linux.com/learn/how-rescue-non-booting-grub-2-linux%20 but the /boot partition did not include the vmlinuz files hence this approach had to be abandoned
Had to revert to the process mentioned at https://www.easeus.com/partition-manager-software/fix-uefi-boot-in-windows-10-8-7.html and used the Windows recovery drive created earlier.
Followed the below process
2.1 Use diskpart to repair Windows 10/8 UEFI
Insert Windows 10/8.1/8 installation disk or installation USB into PC > Boot from the disk or USB;
Click Repair your computer or hit F8 at the Install now screen;
Click Troubleshoot > Advanced options > Command Prompt;
Type below command and hit Enter each time:
diskpart
DISKPART>
sel disk 0
When the message "Disk 0 is now the selected disk" shows up, type:
list vol
diskpart will now show the full list of volumes on your PC, find UEFI volume from the list:
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions
explains the parition types in detail.
In my case the UEFI partition is Volume 1, has the label as ESP and is FAT32 and 200MB in size.
Type below command and hit Enter each time:
sel vol 1
assign letter=G: Note: G shall be a unique drive letter which cannot be already used;
Now that G: is assigned to the EFI partition we can cd to it, but for that we need to exit the diskpart utility
exit
Next fix the boot
cd /d G:\EFI\Microsoft\Boot\
bootrec /FixBoot
ren BCD BCD.old
bcdboot C:\Windows /l en-us /s G: All
Reference
http://www.dell.com/support/article/us/en/19/sln300987/how-to-repair-the-efi-bootloader-on-a-gpt-hdd-for-windows-7-8-81-and-10-on-your-dell-pc?lang=en
https://superuser.com/questions/1110644/reconstructing-windows-efi-files-in-boot-partition-linuxwindows-dual-boot
BCDBOOT - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment