Dual booting, booting one OS in a VM hosted by the other OS

Hello Jacob,

Thanks for this guide. You have recommended that each OS has its own ESP partition. I have a setup with 3 OSs - Windows, Ubuntu and OpenSUSE and by default when installing them, their bootloaders are all written to the same ESP partition initially created when installing Windows, although in separate folders for each OS.

I tried to get your approach to work using this single ESP partition so that I won’t have to install the Linux OSs all over again. After following your steps (with a single ESP) and when trying to start the Ubuntu installation on VMWare, I get the following error popup:
“Error while powering on: The physical disk is already in use
Cannot open the disk ‘C:\Users\Narayan\Virtual Machines\Ubuntu\Ubuntu.vmdk’ or one of the snapshot disks it depends on.
Module ‘Disk’ power on failed.
Failed to start the virtual machine.”

Is this the reason you proposed a multi ESP setup?

If not, I’d appreciate a bit more background on the need for separate ESPs for each OS or experiences in trying to get this setup to work off a single ESP partition if feasible, to minimise disruption to people like me who already have a working multi-boot setup.

Narayan

I haven’t completed the setup yet on the Windows side, but I’m running a similar setup (encrypted drive).
One thing I noticed was that the grub.cfg file was missing. I ran sudo update-grub but I got error sudo update-grub, so I ran sudo touch /cow, reran sudo update-grub and it created the file. No onto the next step :slight_smile:

I tried poking around:

Everything went well until I attempted to boot up Ubuntu from VMWare. I am confident that the boot.iso file was built correctly (I also mounted it in Windows just to check its content). Any thoughts on what may be wrong? Thanks

A few more details.
If I let it sit there for a while, I get the bios screen. But I’m unsure how to proceed. I attempted to select one of the options.

Here’s what I tried:

  • This didn’t do anything.

I went to the setup option:

Full transparency, I no longer remember how this works! It feels like I wrote this ages ago, and I haven’t used it for a long time.

Long ago, I made the original post a Wiki. Feel free to edit.

My current opinion is that this setup is a bit ill-advised. Unless the OS is designed to be portable, using a single OS installation on multiple devices is always a bit iffy. Driver issues are a given. Proceed at your own risk. I’ve even had a Windows installation become unrecoverable during an update, for some reason.

You can’t mount a file system in two OSes. The VM needs its own ESP. This doesn’t really come up if the VM has it own disk, physical or virtual.

Hi Jacob,

Thanks for your response.

I take it that your comment is about my setup of booting multiple OSs installed on a single disk from a single ESP (created initially by Windows).

I’ve taken your advice and have set up a separate ESPLinux partition on the same disk exclusively for my Linux installations over the weekend. Tweaks to the /etc/fstab files to point /boot/efi to the new ESPLinux partition went smoothly.

Accordingly, I created a fresh VMware machine for my Ubuntu installation using the new ESPLinux partition, but I get the same error message:
“Error while powering on: The physical disk is already in use
Cannot open the disk ‘C:\Users\Narayan\Virtual Machines\Ubuntu\Ubuntu.vmdk’ or one of the snapshot disks it depends on.
Module ‘Disk’ power on failed.
Failed to start the virtual machine.”

If you or anyone have any insights on why this problem is occurring even though I am now using 2 exclusive partitions for /boot/efi and /root that aren’t mounted by Windows at all, I’d appreciate it.

Note that all my partitions - the Windows, Windows ESP, Linux ESP and Linux root - are on a singly physical disk. Does your solution require them to be on separate disks?

Thanks
Narayan

This wasn’t necessary. As long as the hypervisor supports it, there’s no reason the VM shouldn’t be able to mount it.

Were you able to follow these steps when setting up the VM? (See the OP for full instructions) Confirm that they’re still set.

Yes indeed. I did select both those options and selected the two partitions that are mounted as /boot/efi and /root so that they align with /etc/fstab entries.

The one thing I haven’t done as per your instructions is to have the Linux ESP as the default boot entry. In my setup, the UEFI bootloader has Windows as the 1st and default boot entry. The Linux ESP has 2 folders - 1 each for the Ubuntu and OpenSUSE bootloaders which show up as 2 additional entries in the UEFI bootloader. I’ve setup Grub on both these Linux partitions so that they are used only to boot themselves and not any other partitions, not even Windows. This way, I control the boot selection exclusively through the UEFI bootloader by pressing F12 on boot.
Don’t know whether this should matter.

Also, I probably haven’t mentioned that mine’s not a Framework laptop; it’s a Lenovo Legion laptop and I came across these instructions when searching for ways to boot a multi boot setup on raw disk in VMWare and assume that this approach should apply to all machines.