Dual boot in a KVM Virtual Machine

If you want to experiment with multi-booting in Linux, you might want to consider experimenting with a virtual machine.

In this blog post, I’ll show you how to install two Linux distributions on the same KVM virtual machine.

I’ll use Fedora 40 and EndeavourOS Gemini. Make sure you download their ISOs.

Let’s create the virtual machine:

You need to specify enough space for the storage for two Linux distributions.

Of course, I’m going to use UEFI:

And 3d acceleration:

Let’s start the installation of Fedora:

I’m going to use manual partitioning, e.g., in Fedora, the only usable tool I can think of: Blivet-GUI:

I’m creating the partition for UEFI:

And the partition for the main system. Although I could choose the entire disk, and then resize it later when installing EndeavourOS, let’s make things simpler and only use half of the space of the VM’s disk:

We can continue the installation til the end.

Restart the virtual machine and finalize the Fedora installation.

Shut down the virtual machine.

You might want to create a snapshot in case you want to return to this step.

Now, we must configure the virtual machine to give precedence to the CD ROM as a boot device and “insert” in the CD drive the ISO of EndeavourOS Gemini (see my review).

Let’s edit its “Details” accordingly:

First, enable “SATA CDROM 1” and move it up in order:

Then, load the ISO in the SATA CDROM 1:

Let’s start the virtual machine, which will now boot from the EndeavourOS Live ISO:

Now, we can install EndeavourOS Gemini (see my review). The critical part are choosing GRUB:

And the partitioning: we must choose manual partitioning:

Now, we must mount the existing EFI partition (the one we created during the Fedora installation above) as “/boot/efi”

And allocate the rest of the free space to EndeavourOS (I choose BTRFS here); if you want to add another installation later, you might want to leave some free space.

Here’s the result:

You then get a warning about the EFI partition expected to be FAT32, while Fedora created it as FAT16, but you can ignore it: the installation will succeed anyway:

That’s the summary:

Let’s conclude the installation.

At the end of the installation, instead of “restart”, shut the machine down.

In fact, we have to “virtually” remove the CD ROM as the first boot media; otherwise, the virtual machine will always boot from the ISO (you can also remove the ISO from the virtual CD ROM). We basically revert the operations we performed before installing EndeavourOS:

Now, the EndeavourOS GRUB menu will appear instead of the Fedora one:

Let’s boot into it and make sure everything works.

Now, let’s reboot the virtual machine; this time, we select the “UEFI Firmware Settings” in the GRUB menu:

And we’re into the “Tiano” UEFI:

By selecting “Boot Manager”, we access the list of available UEFI entries:

We can select “Fedora”, now in the second position, and temporarily boot that.

Alternatively, we can change the boot order:

That’all! Now, you can experiment with multi-booting.

Happy “virtual” multi-booting! šŸ˜‰

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.