How To Install KVM on Linux Mint 22

Install KVM on Linux Mint 22

Running multiple operating systems on a single machine without giving up performance is one of the most practical skills a sysadmin or developer can have. If you have been relying on VirtualBox or VMware for that, it is time to look at something more powerful. This guide walks you through exactly how to install KVM on Linux Mint 22, from verifying hardware support all the way to creating your first virtual machine.

KVM (Kernel-based Virtual Machine) is not just another virtualization tool. It is a Type-1 hypervisor built directly into the Linux kernel. That means it talks to your CPU hardware directly, with no extra software layer in between. The result is near-native VM performance that tools like VirtualBox simply cannot match, because they sit on top of the OS rather than inside it.

Linux Mint 22 (codenamed Wilma) is based on Ubuntu 24.04 LTS, which means it uses the same apt package manager and inherits the same long-term supported kernel. This is important because it guarantees that all KVM packages in this guide come from stable, well-maintained repositories and will not break after a routine system update.

By the end of this guide, you will have a fully working KVM hypervisor running on Linux Mint 22, complete with QEMU, libvirt, virt-manager, proper user permissions, optional network bridging, and a working virtual machine.

Prerequisites

Before you start, make sure your system meets the following requirements:

  • Operating System: Linux Mint 22 (Wilma), based on Ubuntu 24.04 LTS
  • CPU: 64-bit processor with Intel VT-x or AMD-V hardware virtualization support
  • RAM: Minimum 4 GB (8 GB or more is strongly recommended if you plan to run multiple VMs)
  • Disk Space: At least 20 GB of free space for VM images
  • User Access: A user account with sudo privileges
  • Internet Connection: Required to download packages from official repositories
  • BIOS/UEFI Access: Needed if hardware virtualization is not yet enabled
  • Basic Terminal Skills: You should be comfortable running commands in a terminal

Step 1: Verify Your CPU Supports Virtualization

This is the most important step in the entire process. KVM delegates privileged CPU instructions to hardware-level virtualization rings. Without Intel VT-x or AMD-V active in the CPU, the Linux kernel cannot create the isolated execution environments that VMs depend on. You must confirm this before installing a single package.

Check for VT-x or AMD-V Support

Run this command in your terminal:

lscpu | grep Virtualization

Expected output on Intel:

Virtualization:    VT-x

Expected output on AMD:

Virtualization:    AMD-V

If the output is blank, hardware virtualization is either not supported or is turned off in BIOS/UEFI. Boot into your BIOS settings (usually by pressing F2 or Delete during startup), navigate to the CPU configuration section, and enable “Intel Virtualization Technology” or “SVM Mode” for AMD processors.

Check the KVM Kernel Module

Linux Mint 22 ships with the KVM module compiled into the kernel, but it is worth confirming before you proceed:

zgrep CONFIG_KVM /boot/config-$(uname -r)

You are looking for lines showing CONFIG_KVM=m or CONFIG_KVM=y. A value of m means it loads as a module, and y means it is baked into the kernel. Either value means you are good to go.

Install and Run the cpu-checker Tool

For a plain-English result, install cpu-checker:

sudo apt install cpu-checker -y
kvm-ok

Expected output:

INFO: /dev/kvm exists
KVM acceleration can be used

This tool wraps the raw CPU flag check into a simple pass/fail message. It is the fastest way to validate readiness on any machine before committing to a full installation.

Quick Flag Count Check

egrep -c '(vmx|svm)' /proc/cpuinfo

The vmx flag is Intel VT-x. The svm flag is AMD-V. Any number greater than 0 shows how many logical CPU threads support hardware virtualization. A result of 0 means the feature is not active.

Step 2: Update Linux Mint 22 Before Installing KVM

Skipping system updates before a major software installation is one of the most common causes of dependency conflicts. The apt package manager resolves package versions at install time. If your local cache is stale, it may pull older versions of KVM components that are not fully compatible with your current kernel.

sudo apt update && sudo apt upgrade -y

Why run both commands together? apt update refreshes the local package index from the repositories. apt upgrade installs available updates for all installed packages. Running them together ensures your system baseline is consistent before any new packages arrive.

If the upgrade includes a kernel update, reboot before proceeding:

sudo reboot

The KVM kernel modules (kvm.ko, kvm-intel.ko, kvm-amd.ko) must match the version of the running kernel. Installing them while a mismatched kernel is active will cause load failures.

Step 3: Install KVM, QEMU, and Virt-Manager on Linux Mint 22

Now you are ready to install the full KVM stack. Linux Mint 22 already includes the KVM kernel modules. What you need to install is the user-space tooling: QEMU for hardware emulation, libvirt for VM management, and supporting utilities.

sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients \
bridge-utils virt-manager virtinst virt-viewer ovmf swtpm \
qemu-utils guestfs-tools libosinfo-bin

Here is what each package does and why it is needed:

Package Role Why It Is Needed
qemu-kvm Core emulator Connects user-space to KVM kernel modules for CPU virtualization
libvirt-daemon-system Background daemon Manages VM lifecycle; required for virsh and virt-manager to function
libvirt-clients virsh CLI Lets you control VMs from the terminal without a GUI
bridge-utils Network bridge tools Required to create bridged network interfaces for VMs
virt-manager GUI manager Point-and-click interface for creating and managing VMs
virtinst virt-install CLI Enables scripted and automated VM provisioning
virt-viewer VM console Lightweight graphical display for connecting to running VMs
ovmf UEFI firmware Required for UEFI/Secure Boot support in guest VMs
swtpm TPM emulator Needed for Windows 11 VMs that require TPM 2.0
qemu-utils Disk image tools qemu-img creates, converts, and manages VM disk images
guestfs-tools Filesystem tools Inspect and modify VM disk images without booting the VM
libosinfo-bin OS info library Helps virt-install automatically detect the best settings for each OS

Why KVM Needs Both QEMU and libvirt

KVM kernel modules alone have no user-space interface. They provide the low-level CPU virtualization infrastructure but cannot create VMs on their own. QEMU fills the gap by emulating hardware devices (network cards, storage controllers, video adapters) while KVM handles the CPU instructions at hardware speed. libvirt then sits on top of both, providing the daemon, APIs, and CLI tools that make managing VMs practical. Without all three layers working together, you have no usable hypervisor.

Step 4: Enable and Start the libvirt Daemon

Installing libvirt does not automatically start or enable the libvirtd service. Every VM operation, whether from virsh, virt-manager, or any other tool, goes through this daemon. If it is not running, all VM management calls will fail immediately with a “connection refused” error.

sudo systemctl enable --now libvirtd

The --now flag both enables the service at boot and starts it immediately in a single command. There is no need to run start and enable separately.

Verify the Daemon is Running

sudo systemctl status libvirtd

Expected output:

● libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled)
     Active: active (running) since ...

If the status shows failed instead of active (running), check the logs for the specific error:

journalctl -xe | grep libvirt

On Linux Mint 22, a failed libvirtd after a kernel update is almost always caused by a module version mismatch. A reboot after the update resolves this in most cases.

Step 5: Add Your User to the KVM and libvirt Groups

This step is one that beginners frequently skip, and it is responsible for a large number of failed VM launches. Two separate group memberships are required to use KVM as a regular user.

sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER

Why the kvm Group Matters

The /dev/kvm device node, which is the actual interface to the KVM kernel module, is owned by the kvm group. If your user account is not a member of this group, the kernel will reject any attempt to open that device with a permission denied error. No group membership means no VM launches outside of root.

Why the libvirt Group Matters

The libvirtd management socket lives at /run/libvirt/libvirt-sock. By default, only root and members of the libvirt group can write to this socket. Without group membership, virsh and virt-manager cannot communicate with the daemon.

Apply the Group Changes

Log out and log back in to apply the new group memberships. Alternatively, use this command to open a new shell with the groups active immediately:

newgrp libvirt

The reason you need to log out is that Linux applies group changes to new login sessions only. Running newgrp opens a child shell with the group applied, which works fine for testing. For permanent daily use, a full logout is cleaner.

Verify Group Membership

groups $USER

The output should include both kvm and libvirt in the list.

Step 6: Verify the KVM Installation is Working

Before creating any VMs, run a full validation of your virtualization environment. This confirms that all components installed correctly and that the host is ready to run guest operating systems.

Run virt-host-validate

sudo virt-host-validate qemu

This tool checks CPU hardware support, IOMMU status, cgroup availability, and namespace isolation. Each check returns a clear PASS, WARN, or FAIL result.

Example output:

QEMU: Checking for hardware virtualization   : PASS
QEMU: Checking if device /dev/kvm exists     : PASS
QEMU: Checking if device /dev/kvm is accessible : PASS
QEMU: Checking if device /dev/vhost-net exists : PASS
QEMU: Checking if device /dev/net/tun exists : PASS
QEMU: Checking for cgroup 'memory' controller support : PASS
QEMU: Checking for cgroup 'cpu' controller support   : PASS

WARN results for IOMMU are common and not critical unless you need PCIe passthrough for dedicated GPU or NIC assignments.

Confirm KVM Modules Are Loaded

lsmod | grep kvm

Expected output (Intel system):

kvm_intel    xxxxxx  0
kvm          xxxxxx  1 kvm_intel

For AMD systems, you will see kvm_amd instead of kvm_intel. If neither module appears, the KVM installation is incomplete or BIOS virtualization is still disabled.

Test the libvirt Connection

virsh -c qemu:///system list

A successful response (even an empty VM list) confirms that virsh can reach the libvirtd daemon through the QEMU/KVM backend. This is the exact path that virt-manager uses, so if this works, the GUI manager will work too.

Step 7: Configure a Network Bridge for External VM Access (Optional but Recommended)

By default, KVM uses NAT networking through a virtual interface called virbr0, operating on the 192.168.122.0/24 subnet. VMs on NAT can access the internet but nothing from outside the host can reach them directly. This is fine for isolated testing environments, but it is a problem if you want VMs to act as real servers on your local network.

A network bridge (br0) gives each VM a direct presence on your physical LAN. Other machines on your network can reach your VMs by their own IP addresses, and the VMs behave just like physical machines plugged into your router.

Important: Network bridging does not work over Wi-Fi. The IEEE 802.11 standard’s 3-address frame format does not support bridge interfaces. This step only applies to wired (Ethernet) connections.

Find Your Network Interface Name

ip link show

Identify your active Ethernet interface. It will typically look like enp3s0 or enp2s0.

Create the Bridge Using NetworkManager

Linux Mint 22 uses NetworkManager as the default network stack. Use nmcli so the changes persist and integrate properly with the system:

sudo nmcli connection add type bridge con-name br0 ifname br0
sudo nmcli connection add type ethernet slave-type bridge \
  con-name 'Bridge Slave' ifname enp3s0 master br0
sudo nmcli connection modify br0 connection.autoconnect-slaves 1
sudo nmcli connection up br0

Replace enp3s0 with your actual interface name from the previous step.

Why Use nmcli Instead of Editing Config Files

On Ubuntu 24.04-based systems (including Linux Mint 22), editing /etc/network/interfaces directly bypasses NetworkManager. Changes made that way can be overwritten by NetworkManager on the next reboot or network event. Using nmcli writes changes into the NetworkManager connection database, ensuring they survive reboots and coexist with the desktop network applet without conflicts.

Verify the Bridge is Active

nmcli device status

You should see br0 listed with a state of connected.

Step 8: Launch Virt-Manager and Create Your First VM

With KVM configured and verified, you are ready to create a virtual machine. Virt-manager provides a clean graphical interface. Running it from the terminal first is a good habit because any permission errors will appear as readable text output rather than a silent GUI crash.

virt-manager

Create a VM via the Virt-Manager GUI

  1. Click File > New Virtual Machine
  2. Select Local install media (ISO or CDROM) and click Forward
  3. Click Browse and navigate to your downloaded ISO file
  4. Set the RAM allocation (do not exceed 50-60% of your total host RAM for a single VM to avoid host memory pressure)
  5. Set the disk size (minimum 20 GB for most Linux distributions)
  6. Give the VM a name and click Finish

Virt-manager creates a .qcow2 sparse disk image, which only consumes actual host disk space as data is written. A 40 GB allocated image will not use 40 GB on your drive immediately, just the space that is actually written.

Create a VM from the Command Line

For scripted setups or headless servers, use virt-install:

sudo virt-install \
  --name myvm \
  --ram 2048 \
  --vcpus 2 \
  --disk path=/var/lib/libvirt/images/myvm.qcow2,size=20 \
  --os-variant ubuntu24.04 \
  --cdrom /path/to/ubuntu.iso \
  --network network=default,model=virtio \
  --graphics spice

The --network model=virtio flag is important. VirtIO is a para-virtualized driver that creates a direct communication channel between the guest and the host kernel, bypassing full hardware emulation for the network adapter. This delivers near-native network throughput compared to emulating a full virtual NIC in software.

Grant User Access to the VM Images Directory

By default, only root can access /var/lib/libvirt/images/. Set ACL permissions so your user can work with disk images directly:

sudo setfacl -R -b /var/lib/libvirt/images
sudo setfacl -R -m u:$USER:rwX /var/lib/libvirt/images
sudo setfacl -m d:u:$USER:rwx /var/lib/libvirt/images

The lowercase x on the default rule applies execute permissions to new subdirectories. The capital X on the recursive rule limits execute permissions to directories only, not files, which follows the principle of least privilege.

Troubleshooting Common KVM Issues on Linux Mint 22

Even with a clean install, a handful of issues appear often enough that every sysadmin running this configure KVM on Linux Mint 22 setup should know how to handle them.

Problem 1: kvm-ok Returns “KVM acceleration can NOT be used”

Cause: Hardware virtualization is disabled in BIOS/UEFI.

Fix: Reboot into BIOS settings. Look for “Intel Virtualization Technology” (Intel) or “SVM Mode” (AMD) under the CPU or Advanced settings tab. Enable it, save, and reboot. Run kvm-ok again to confirm.

Problem 2: libvirtd Fails to Start

Cause: KVM kernel module is not loaded, often because of a kernel version mismatch after an update.

Fix:

sudo modprobe kvm-intel   # Intel systems
sudo modprobe kvm-amd     # AMD systems
sudo systemctl restart libvirtd

If the module fails to load, reboot. The modules must match the running kernel version exactly.

Problem 3: Virt-Manager Shows “Unable to Connect to QEMU”

Cause: The current user is not in the libvirt group, or the group change was made but the user has not logged out and back in yet.

Fix:

sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER

Then log out completely and log back in. Using su - $USER in a terminal does not apply group changes the same way a full session logout does.

Problem 4: VMs Have No Network Access

Cause: The default virtual network managed by libvirt is not active.

Fix:

sudo virsh net-start default
sudo virsh net-autostart default

On a fresh install, this network should start automatically. If you reinstalled libvirt or restored a backup, the autostart setting may have been reset.

Problem 5: Windows 11 VM Fails to Boot or Install

Cause: Windows 11 requires UEFI firmware and TPM 2.0. Virt-manager defaults to legacy BIOS and no TPM.

Fix: When creating the VM, under the firmware setting, select UEFI x86_64: /usr/share/OVMF/OVMF_CODE_4M.fd. Under the hardware configuration, click Add Hardware, select TPM, and choose Emulated with type TIS and version 2.0. The ovmf and swtpm packages you installed earlier handle both of these requirements.

Congratulations! You have successfully installed KVM. Thanks for using this tutorial for installing the Kernel-based Virtual Machine (KVM) on your Linux Mint 22 system. For additional or useful information, we recommend you check the official KVM website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!
r00t is a dedicated and highly skilled Linux Systems Administrator with over a decade of progressive experience in designing, deploying, and maintaining enterprise-grade Linux infrastructure. His professional journey began in the telecommunications industry, where early exposure to Unix-based operating systems ignited a deep and enduring passion for open-source technologies and server administration.​ Throughout his career, r00t has demonstrated exceptional proficiency in managing large-scale Linux environments, overseeing more than 300 servers across development, staging, and production platforms while consistently achieving 99.9% system uptime. He holds advanced competencies in Red Hat Enterprise Linux (RHEL), Debian, and Ubuntu distributions, complemented by hands-on expertise in automation tools such as Ansible, Terraform, Bash scripting, and Python.

Related Posts