Missing windows boot options
I have tried to install ElementaryOS on my machine, and I have wiped out my boot partition by accident.
I have successfully installed Elementary OS (0.6 Odin, even though it doesn't matter). Now, my grub shows only Elementary, and I cannot get into my Windows.
I have tried the following process (os-prober
haven't done anything useful):
Running parted -l
yields the following result:
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 473MB 472MB ntfs Basic data partition hidden, diag
3 577MB 593MB 16.8MB Microsoft reserved partition msftres
4 593MB 157GB 157GB ntfs Basic data partition msftdata
5 157GB 158GB 541MB ntfs hidden, diag
2 158GB 158GB 294MB fat32 NO NAME boot, esp
6 158GB 250GB 91.9GB ext4 elementary OS
I know that sda2
is the new boot partition I have created. sda4
is the partition of Windows 10, and sda5
is the recovery partition? (I'm really not sure of that).
I have tried to add both sda5
and sda4
to my GRUB by adding the following lines to /etc/grub.d/40_custom
:
#!/bin/sh
exec tail -n +3 $0
menuentry "Windows 10 Recovery" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set=root EE92464E92461C09
chainloader +1
}
menuentry "Windows 10" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos4)'
search --no-floppy --fs-uuid --set=root 28981AAB981A7790
chainloader +1
}
After using:
> sudo blkid /dev/sda4
/dev/sda4: UUID="28981AAB981A7790" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="09b51487-4e98-458a-9a50-0a4470e4f844"
> sudo blkid /dev/sda5
/dev/sda5: UUID="EE92464E92461C09" TYPE="ntfs" PARTUUID="6805dc0a-c750-4ef6-a06d-f41ad4ab3f2a"
And of course, I ran sudo update-grub
.
However, I get an error: "Invalid EFI file path" when trying to boot from these new entries.
Also, mounting the new boot partition and running ls
yields:
EFI
-> BOOT
-> ubuntu
Meaning, I don't have the windows (and windows recovery) boot entries.
I really don't want to reinstall my windows and Elementary again. However, I have no idea how to fix this.
+1
asks the 'chainloader' command to load the 1st sector of the partition. But your computer uses EFI firmware – it doesn't use boot sectors, so "+1" will do nothing useful at all. Instead, the parameter to the 'chainloader' command has to be a path to an *.efi
executable file containing the bootloader.
Windows always installs its bootloader at \EFI\Microsoft\Boot\bootmgfw.efi
(relative to the root of the EFI system partition, not the main Windows partition, so you shouldn't be using "set root" either).
(The "part_msdos" bit is incorrect too, as your disk has a GPT partition table. Basically the entire custom menu item is specific to BIOS systems and does not apply to your EFI machine.)
Since you've deleted the old partition – boot from a Windows install CD (or USB stick), hit Shift+F10 to open a console window, then use the bcdboot c:\windows
command to reinstall the Windows bootloader – it will copy all necessary files, rebuild the "BCD" configuration file, and add an EFI boot entry.
(If creating the Windows USB stick using Rufus, make sure you select the UEFI mode, as it only does one or the other.)