Score:0

How to manually setup Windows 10 and Ubuntu 22.04 Dual Boot under UEFI

vn flag

Note: Please read the full post with due diligence before posting comments/answers or downvoting/closing this question

Premise:

I first installed Windows 10 on my notebook-PC which created the EFI and other system partitions. I also created an extra partition. Once Windows was setup, I proceeded to install Ubuntu 22.04 on the extra partition; instead of choosing the "Install alongside Windows" option, I used the "Something else" option to complete the installation. Ubuntu installer created a directory called ubuntu under the EFI directory on the eponymous partition.

Desired Outcome:

The dual boot functionality only works if I use the firmware boot manager (the one that can be accessed from the UEFI boot up screen by pressing some Fx key on startup). I want the Ubuntu OS entry to show up under the Windows Boot Manager.

What I tried:

Using the bcdedit tool in windows I performed the following steps:

  1. bcdedit /copy {bootmgr} /d "Ubuntu 22.04" <--- returns a guid
  2. bcdedit /set {guid} path "\EFI\ubuntu\shimx64.efi"

Although an entry for Ubuntu 22.04 shows up in the Windows Bootloader Menu, when I select it, after a restart, the error message thrown is:

.
.
.

Status: 0xc000007b

Path: \EFI\ubuntu\shimx64.efi

Message: The required file is missing or corrupted...

Perceived Problem:

I did some digging and I think the problem is this: chainloading error.

When the Windows Boot Manager tries to load the GRUB loader, the grub.cfg file at \EFI\ubuntu\ tries to find a filesystem with an ID assigned by Ubuntu (whereas Windows assigns a different ID to the same partition for ubuntu). So, when attempting to load the shimx64.efi Windows Boot Manager simply fails to find the required files.

Possible Solution:

This is where I need help - I think the problem can be solved by copying over some required files (say the mod files and actual grub.cfg) from the actual Ubuntu partition, into the EFI partition. So, the question is, which files and exactly what file structure?

anurag avatar
vn flag
Just to emphasize, I am NOT looking for a solution which makes GRUB2 the default boot manager, I want the Windows Boot Manager to remain the default while adding an entry for Ubuntu inside it.
oldfred avatar
cn flag
This is really a Windows question. But my limited understanding of Windows is that it is only designed to dual boot multiple versions of Windows. Only Ubuntu and official flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic here, refer to https://askubuntu.com/help/on-topic where you'll find other SE sites where you question will be welcome We mostly use grub2 with some using rEFInd or systemD boot to boot Ubuntu and they are designed for multiple booting. A few prefer just to use the UEFI system boot menu, often f12 but varies by vendor.
anurag avatar
vn flag
@oldfred this is on-topic because the configurations need to be made with the GRUB2. The solution involves fixing the directory of ubuntu in the EFI partition. This NOT a Windows only problem. Please read the complete question post patiently.
cc flag
The only UUID the 3 line stub grub.cfg file in the EFI partition has it the one for Ubuntu's root. (Note, not the PARTUUID.) That same UUID is used in the maintained grub.cfg in /boot/grub, so moving the actual grub.cfg file to the EFI, while it should work, will still fail if that UUID is wrong. What machine are you using? Saw some new boot problems on an 2012 Toshba last install -- had to force with bcdedit.
user535733 avatar
cn flag
Does this answer your question? [How to use windows bootloader instead of grub using UEFI?](https://askubuntu.com/questions/1181657/how-to-use-windows-bootloader-instead-of-grub-using-uefi)
anurag avatar
vn flag
@user535733, care to explain how the link "answers" my question?
anurag avatar
vn flag
@ubfan1, in my observation, the UUID in the grub.cfg is a number generated by Ubuntu for the particular partition and is different from the ID generated by Windows. The problem I think is this: when WBM is chainloading GRUB2, the disks remain loaded under WBM and the IDs are not what GRUB2 expects.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.