1

Goal: I would like to install my main Linux distro on top of KVM, equivalent to dom0 in Xen hypervisor parlance. I know that running an OS on top of a hypervisor is not uncommon and that KVM has been baked into the Linux kernel since 2.4 or so. The question is how to configure the system so that it does so automatically on boot. Ideally, the bootloader would start KVM before mounting the disks and booting into the OS.

Question: How does one accomplish this?

1 Answer 1

1

As you noted, KVM is part of the Linux kernel (hence the K).

Your dom0-equivalent hence is Linux kernel that you boot. KVM depends on a Linux userland to set up VMs.

There's no KVM without a host Linux.

You could invent a Linux distro that only contains a initrd with enough user land to set up the VMs you need. The practical challenge will be making sure you can hand over the graphics card used at boot to the guest. I've yet to make that work on a PC; and I guess that's what you'd want with a "main" OS.

But honestly, I don't know exactly how that would differ positively from established solutions like OpenStack; something with high privileges needs to coordinate things. After all, running VMs also ideally requires an orchestrator caring for connecting to storage, configuring external and internal networking, initiating snapshots and doing migrations. In that spirit, OpenStack has backends for both KVM and Xen, if I'm not mistaken.

If you're really just looking for something slim that can start and stop VMs very rapidly, maybe firecracker is for you.

3
  • 1
    I agree. In addition to Openstack, there is proxmox.com. Commented Jul 7, 2023 at 20:18
  • 1
    Thank you for the excellent answer. Something like Firecracker is close, but I only need single-tenant functionality. Thus, it would not require the large monitoring frameworks, etc., and would instead be purely minimalistic running a single guest OS. In other words, it should be effectively baked into the OS to run atop a virtualized kernel or dom0. Commented Jul 10, 2023 at 17:31
  • 1
    Yeah that case is address by the first two quarters of my answer Commented Jul 10, 2023 at 21:38

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.