0

In a dual boot system (Windows 10 and Ubuntu 20.04, for example), both systems use the same EFI partition created by the Windows installer. If I need to format Ubuntu for any reason, like changing distro, I would exclude Ubuntu's partitions normally, but then I suppose the boot loader for Ubuntu would still exist in the EFI partition.

If I just delete Ubuntu's partitions normally and install another distro (and put the loader in the same EFI partition as before), this could lead to some problem?

Assume the EFI partition was created manually in the Windows' installer (using Diskpart) and have a size of 550Mb.

Another thing is, if the EFI partition was created using Diskpart in the Windows' installer, the system would automatically recognize this EFI partition during installation of Windows 10 or the installer would create another one?

2
  • 1
    "If I need to format Ubuntu for any reason, like changing distro, I would exclude Ubuntu's partitions normally, but then I suppose the boot loader for Ubuntu would still exist in the EFI partition." - You would simply restore the Windows bootloader at this point./
    – Ramhound
    Commented Mar 27, 2022 at 22:26
  • @Ramhound So I suppose this could be done using a live media of Windows. That must be easy to do. Your comment also responds the second paragraph, since I could just restore the EFI partition before installing another distro and prevent possible problems. Thanks a lot.
    – Ezau
    Commented Mar 27, 2022 at 22:29

2 Answers 2

0

Multi-Boot with UEFI on one disk does work like Multi-Boot on legacy BIOS systems: you have one bootloader on the disk, and this boot loader then has to offer to you the selection.

The UEFI sees the EFI partition and looks for the file /EFI/BOOT/BOOTX64.EFI, which is the boot loader for X64 based computer. This file under Windows is the Windows boot loader, which gets its configuration from /Microsoft/BOOT/BCD. If you have the Grub as Bootloader (still, always stored as "BOOTX64.EFI"), then you would find the Grub configuration where you expect it. Modern secure boot systems have the SHIM loader as BOOTX64.EFI, which then jumps to the GRUB (usually in /EFI/BOOT/GRUB64.EFI – at least that’s the default name), which then does the rest. Under Windows, no SHIM is needed, because the Windows boot loader is already correctly signed.

So if you have multi-boot, you either have the Windows bootloader with multiple boot entries (which you can configure using BCDEDIT), or you have the Grub, which then loads multiple options, amongst them also the Windows boot loader. Whichever option you choose (and is easier to install/maintain), if you re-install both Windows or Ubuntu, or replace Ubuntu with any other Linux, special care has to be taken to not overwrite the entire boot loader, but the adjust the multi-boot selection that is present in the EFI partition, and which depends on your initial setup (whether using Windows boot loader or GRUB as starting point).

5
  • "if you re-install both Windows or Ubuntu, or replace Ubuntu with any other Linux, special care has to be taken to not overwrite the entire boot loader, but the adjust the multi-boot selection that is present in the EFI partition". Suppose I won't touch the Windows and just want to replace Ubuntu. At this point, it would be enough to just restore the EFI partition using Windows' installer, for example?
    – Ezau
    Commented Mar 27, 2022 at 22:52
  • I realize that if I format Windows (and thus deleting the EFI partition) I would lose the boot for the linux too.
    – Ezau
    Commented Mar 27, 2022 at 22:54
  • Depends on the definition of "format Windows". Formatting C: of course does not delete the EFI partition. Nuking the entire disk (i.e. writing a new partition table) you would not only lose the boot for the Linux, but usually also the Linux itself. Not sure what options the Windows installer has for integrating with existing bootloaders, though.
    – Ro-ee
    Commented Mar 27, 2022 at 23:07
  • Normally I use C: for the Windows system and D: for everything else, like install games and other programs. When I have to reinstall Windows, I normally format both C and D, in case there is a virus in some partition. So in general, I just format the partitions, never the entire disk, so if I need to reinstall Windows, I would format C: and D: and let the linux partition untouched (I normally use just one linux partition). Even using two partitions for Windows, and have never formatted only the C:.
    – Ezau
    Commented Mar 27, 2022 at 23:13
  • But now I believe I can manage the problem here. Actually I have Windows 10 installed in UEFI and Ubuntu 20.04 in legacy. So I want to install both systems in UEFI, but I'll have to format the Windows in order to do that. Now I think I can do it. After reinstall Windows, I can install linux and put the bootloader in the EFI partition. I'll just have to create the EFI partition via Diskpart when installing Windows, because the installer creates it with 100mb size, and I read the recommend is 512mb. Now I just don't know if windows' installer will create another EFI. Thanks a lot for the help.
    – Ezau
    Commented Mar 27, 2022 at 23:18
0

I came to a solution with help of users @Ro-ee, @Ramhound, and a lot of research. I waited to write a solution because I was still testing everything.

Summing up the problem:

I had a dual boot of Windows 10 with Ubuntu 20.04 LTS. By wrong configuration in the firmware (also known as BIOS, but I think they are not the same thing), Windows was installed in UEFI mode and Ubuntu in BIOS mode.

I could specify a bunch of technical stuff I learned by researching to solve the problem, but the text would be huge, so in case anyone has the same problem I had here, I believe it would be easier to search the internet. Therefore, I will make a simple summary of the solution.

Solution summary:

The only viable way to solve the problem was to actually format everything. I downloaded Windows 10 and booted from the flash drive. On the partitioning part (again, using the Windows installer) I deleted all partitions, both Windows and Ubuntu. So I had to manually create an EFI partition, because Windows automatically creates this partition, but with a size of 100MB, and the recommended for dual boot is 512MB. To create this partition, use the command line (the famous prompt). By pressing Shift+F10 it will open and there the EFI partition will be created using Diskpart. If anyone needs to do this kind of thing, just search the internet. It's very easy to do this.

So I created the EFI partition with a size of 550MB, because I also read recommendations with that size. After that, I closed the prompt and followed the installation process normally, creating partitions C and D for Windows. The installer normally created the Windows reserved partition and the recovery partition, but it is worth mentioning that the recovery partition did not appear in the installer as usual, if I'm not mistaken. But after installing Windows, I opened the partition manager and saw that the recovery partition was created normally, so everything was fine.

The installer also automatically recognized that an EFI partition already existed, and therefore did not create another one.

Installation of the linux distro (in my case, Kubuntu):

The installation of Kubuntu was done normally. I downloaded the iso on Windows 10 and created the bootable pendrive. I created the partitions normally during the installation, as is done in any video/tutorial. The only difference here is that the boot must be placed on the same EFI partition created by Windows 10, that is, in the partitioning window, that last option that asks where the boot device should be installed, the option to be chosen is the partition EFI (I think in my case it was like sda1). And ready. Just put it to install normally. Both systems will boot from the EFI partition of Windows 10 and when turning on the computer, the user will be presented with options to choose which system he wants to enter.

NOTE: it may happen that the boot options only appear if the user presses the boot options shortcut key. In my case, that key is F12.

About firmware settings (also called BIOS by many):

I put the firmware to "uefi only" mode, that is, I disabled legacy mode. I also had to disable the CSM option. CSM is a legacy support module (although the name is "gourmetized"), so if you leave it active, it can happen that the system installs in BIOS mode, even selecting UEFI mode on the pendrive (which is what happened here and generated the problem of having a system in UEFI and another in BIOS).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .