0

I have previously had Windows 10 and Ubuntu installed with grub being able to dual boot to Windows and to Ubuntu. I have decided to reinstall Ubuntu due to reasons and unfortunately, it installed wrong grub configuration. Now I am not able to boot to Windows, it is not seen from grub (or os-prober).

I have multiple disks, Windows is installed on one SSD (sdc) and Linux has its own HDD (sda).

I think I have tried multiple answers from askubuntu.com, however none of them have worked so far and I feel more lost regarding which configuration everything is installed in, whether legacy or uefi, especially because it was working previously.

I am attaching my boot-repair report: boot-repair report

From the report I can see that Windows is detected, when I tried using Windows Live Disk to use cmd bootrec /FixMbr, it succeded, but nothing changed. Automatic repair did not. Also the report states that sdc1 has Boot files:

  • /bootmgr
  • /Boot/BCD

In GParted I can see that /sdc1 has flags boot.

Boot-repair has suggested steps which it cannot do by itself, so I tried that way. I booted from live usb and started following instructions. At one point, they wanted to manually remove grub, which I was unable to do, due to apt wanting cdrom inserted - askubuntu

I have tried to boot directly from Windows disk, then I receive error no such device, unknown filesystem: enter image description here

Do you know how I can fix this and get my proper boot configuration? I have tried changing BIOS legacy / uefi settings but I'm unsure how and what would be best configuration - bios page

I do want to keep my Windows installation, but I am fine to reinstall ubuntu once again to do it properly, with grub seeing Windows, but I don't know if reinstallation with current configuration would change anything.

Rad
  • 25
  • If you are using EFI boot, you are missing bootmgfw.efi to allow Windows to be detected by os-prober and booted. Maybe you have installed Windows in legacy BIOS mode, but Ubuntu in EFI mode? – galexite Aug 02 '21 at 07:05
  • Perhaps Windows will start fine when EFI boot is disabled, or a BIOS boot device is selected in the firmware boot options? – galexite Aug 02 '21 at 07:06
  • It's possible that Windows is installed in legacy BIOS mode and ubuntu is not. So for now, the next best step would be to reinstall ubuntu in legacy mode? Also, I have tried to boot directly from Windows drive, however then I receive a message about no such device / unknown filesystem – Rad Aug 02 '21 at 07:11
  • Or, convert your Windows installation to EFI mode. If you can boot a Windows installation disk, or even the existing Windows installation, you can use mbr2gpt. – galexite Aug 02 '21 at 07:13
  • There’s not much benefit either way, though EFI is required to install Windows 11 if you plan on upgrading later on. – galexite Aug 02 '21 at 07:15
  • I cannot boot Windows installation disk, but I can use Windows installation USB, I have tried that with bootrec /FixMbr . I would want to upgrade to Windows 11 in the future, so I may try that. Should I expect bootmgfw.efi file to then appear? And how do I need to change BIOS configuration? I'm confused with it because there is no simple switch UEFI / Legacy which I see in different BIOSes – Rad Aug 02 '21 at 07:21
  • A USB is fine :) Yes, I expect a new ESP to be made on sdc, containing bootmgfw.efi. When you reach the Command Prompt, run diskpart, then at the prompt, type list disks. Make a note of which number is your Windows installation’s disk drive. Type exit or quit to exit diskpart, then run mbr2gpt /validate /disk:<number>, where number is the disk you made a note of from diskpart. Check the output to see if the disk is correct, and it is eligible for conversion. – galexite Aug 02 '21 at 07:29
  • Thank you for this solution, I will try this in several hours. Do I have to boot in UEFI or Legacy or my current configuration (whichever it is)? Is it something reversible? If something goes wrong can I use boot-repair or something else to properly install bootloader to current Windows installation? – Rad Aug 02 '21 at 07:32
  • Your system firmware should have support to disable legacy boot. Perhaps it is under a different name? All Windows 8-compliant motherboards must have an option to disable legacy boot. Could you consult your manual for your motherboard/system? Also, if you plan on installing Windows 11, the TPM (version 2.0) must be enabled in the firmware options too. – galexite Aug 02 '21 at 07:33
  • If it doesn’t work out in EFI-mode with a GPT partition table, you can still restore the MBR for BIOS boot on to the GPT partition table. Notice that I have only validated the disk – this will check to see if the disk is eligible, and Windows thinks it can be converted. Actual conversion occurs with replacing /validate with /convert. – galexite Aug 02 '21 at 07:37
  • You do not need to boot Windows in EFI mode to run mbr2gpt. However, to add a Windows boot entry in the boot order, you need to boot the installer in EFI mode. I can’t remember which switch on bootrec does this (I should think /FixMBR), but I also would recommend you do so after conversion. – galexite Aug 02 '21 at 07:45

1 Answers1

2

Ubuntu is installed in EFI mode, but Windows is installed in legacy BIOS mode

GRUB can't chainload a legacy BIOS bootloader when in EFI mode, and vice versa. This means that Windows is not being added to the GRUB boot menu.

To resolve this issue, either GRUB must be re-installed in legacy BIOS mode, or the Windows installation needs to be converted to boot using EFI.

To detect Windows Boot Manager in EFI boot mode, GRUB searches the EFI System Partitions (ESPs) for bootmgfw.efi. According to the output from Boot-Repair, this file is not present; the disk that Windows is installed to contains a legacy BIOS MBR, and no ESP.

Converting a Windows installation to EFI

Considering OP wishes to upgrade to Windows 11 in the future, the best solution would be to convert the Windows installation to EFI boot.

From a Windows installation (preferably the Recovery environment from that installation, otherwise you will need to supply the /allowFullOS switch to force conversion), or from a Windows PE environment such as the Windows installer, you can run mbr2gpt to convert the Windows disk in to a GPT partition table, and create the ESP.

From the recovery environment of the Windows installation which is to be converted, the system disk is the disk to be converted, so identifying the disk number, and supplying the /disk:<number> argument, is not necessary.

Otherwise, the disk number is identical to the one shown in diskpart. You can run list disk in diskpart from a Command Prompt to identify your disk number:

X:\Windows\System32>diskpart

Microsoft DiskPart version 10.0.19041.964

Copyright (C) Microsoft Corporation. On computer: ...

DISKPART> list disk

You can then type exit to return to the Command Prompt.

Validate the conversion

Before you convert the disk, you must check to see if the disk can be converted, via the /validate switch.

From the Command Prompt:

X:\Windows\System32>mbr2gpt /validate /disk:<number>

If the disk is eligible for conversion, you will see:

MBR2GPT: Validation completed successfully

Perform the conversion

If all is good, and you are confident you have selected the right disk, you can then proceed with the conversion:

X:\Windows\System32>mbr2gpt /convert /disk:<number>

If all goes well, you will see these messages:

MBR2GPT: Conversion completed successfully
MBR2GPT: Before the new system can boot properly you need to switch the firmware to boot to UEFI mode!

If you reboot your system, your Windows installation may start booting over Ubuntu. Once Windows has booted up successfully, you can shut down Windows and select Ubuntu from the boot selection menu in your system firmware.

Updating the GRUB boot menu

Open up a Terminal, then run update-grub:

$ sudo update-grub

You should see Windows Boot Manager added to the GRUB boot menu. If so, you can now disable legacy BIOS boot in the system firmware.

Note also that there should be a Windows Boot Manager entry in your firmware's boot device selection menu. If there isn't, you need to run bootrec /FixMBR to add the option to NVRAM when Windows has booted in EFI mode. This may place the Windows Boot Manager entry higher in the boot order than Ubuntu. To reverse this, from a Terminal, list the NVRAM boot option entries:

$ sudo efibootmgr

Identify the number that corresponds to Ubuntu, then copy the BootOrder, moving Ubuntu to the beginning, and paste it in to the command, i.e., if the boot order is 0001,0002,0003, and Ubuntu is 0003, run:

$ sudo efibootmgr -o 0003,0001,0002

Ubuntu will now boot as the first operating system starting from the next reboot.

galexite
  • 576
  • 2
  • 7
  • Thank you, you were correct, changing Windows to EFI allowed grub to detect it, now I have proper booting configuration – Rad Aug 02 '21 at 14:35
  • Fantastic! Glad it worked out for you. Make sure you have your TPM 2.0 enabled for Windows 11 compatibility! – galexite Aug 02 '21 at 15:50