0

I had Windows 10 dual booting with Ubuntu. Then I realize I could not login to Ubuntu so I tried to fix it with Live CD. In Live CD i mistakenly formatted /dev/sda2 with command mkfs.vfat -F 32 -n "name" /dev/sda2 which is EFI partition.

Here is the listed partitions: partitions

Windows 10 is installed on sda4. Because I couldn't boot to any of them, I reinstalled Ubuntu on sda5

Now I can boot to Ubuntu but I cannot boot to Windows due to sda2 is EFI partition I mistakenly formatted above. I tried to fix using many Linux distro live CD with parted but I can't repair /EFI. Other websites shows that I should use Windows 10 install media and use diskpart. I have Windows 10 USB install media but it won't boot (I'm guessing because it is UEFI boot based). On My BIOS (Asrock) when I tried to "Launch EFI Shell from filesystem ", now it shows error file not found. I used to be able to get EFI shell.

I tried added Windows menu entry to GRUB but still won't boot, I guess because currently Grub doesn't boot via EFI.

menuentry "Windows 10" {
search –fs-uuid –no-floppy –set=root 8A3C60A93C60924D chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}

How can I fix this situation?

My Priority would be to be able to login to Windows while keeping Ubuntu as dual booting.

  • So when you reinstalled Ubuntu, where did you put the /boot? It sounds like you could fix this by reinstalling Ubuntu again and specifying sda2 as EFI during that installation. – Fiximan Jul 9 at 14:13
  • @Fiximan when I reinstalled Lubuntu, I put /boot on sda. How can I specify sda2 as EFI during installation? sda2: __________________________________________________________________________ File system: vfat Boot sector type: FAT32 Boot sector info: No errors found in the Boot Parameter Block. Operating System: Boot files: /EFI/BOOT/bootx64.efi /EFI/BOOT/drivers_x64/ext4_x64.efi isn't this already EFI ? – Raymon Takayama Jul 9 at 14:21
  • Type is EFI, but Ubuntu stores its EFI-files in a different location and just needs to put the loader in the efi-partition. How to do it: during installation use manual partitioning (like you did) and then select sda2 and define type or use as (not sure about the exact wording) to efi. Like sdb2 in this example. – Fiximan Jul 9 at 14:43
  • 1
    You deleted the Microsoft bootloaders, and you're not going to replace them from any Ubuntu disk. They're just files, on a FAT filesystem. You can copy them from another W10 comnputer. – ubfan1 Jul 9 at 15:01
  • 1
    Sure, Microsoft offers the Windows 10 iso-file as a download. Make an install medium with a USB drive from that and boot it. Use the repair options there. Then you will only be able to boot into Windows - because that is what MS does. Then go to UEFI via Windows, make Ubuntu boot loader as first entry, rerun update-grub from ubunutu. Link to W10.iso – Fiximan Jul 9 at 15:10
3

For both Windows & Ubuntu how you boot install/repair media UEFI or BIOS is then how it installs or repairs.

When you reinstalled Ubuntu you reinstalled in BIOS boot mode (and BIOS mode need bios_grub partition as your Boot-Repair report suggests). You now have grub in gpt's protective MBR and no mount of /EFI/ubuntu in fstab. You can convert install to UEFI, by booting live installer in UEFI mode and purging grub-pc and installing grub-efi-amd64. Often easier to do a full reinstall of grub using Boot-Repair.

https://help.ubuntu.com/community/Boot-Repair

If you keep Ubuntu in BIOS mode you will not be able to boot Windows as UEFI & BIOS are not compatible. Once you start booting in one mode you cannot switch, once in BIOS grub can only boot other BIOS systems. And Windows only boots in UEFI mode from gpt partitioned drives.

To fix Windows you will need a Windows repair flash drive, DVD or installer booted in UEFI mode to make UEFI repairs using Windows repair console.

https://superuser.com/questions/460762/how-can-i-repair-the-windows-8-efi-bootloader

After Windows is repaired & has /EFI/Microsoft folder in ESP, you can run grub updates which runs os-prober to add Windows entry to grub menu.

sudo update-grub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.