Posted inApps / Guides / Linux / Open Source

HOW TO: Use KVM/QEMU/Virt-Manager to Set Up Virtual Machines

KVM, QEMU and Virt-Manager virtualization on Linux

Creating virtual machines is fun. And there are plenty of options, including VMware, Parallels, VirtualBox and GNOME Boxes.

Linux users also have the option of using KVM, QEMU, libvirt and a graphical client like Virt-Manager.

We’ve talked about KVM and QEMU before, when we went over how to install macOS on Linux.

Today we’re taking a look at how to install and use KVM, QEMU and Virt-Manager to set up and manage virtual machines on Linux.

Last updated: November 20, 2026.

What Are KVM, QEMU, libvirt and Virt-Manager?

Why so many choices for the home user? Because having choices is always a good thing, and none of them are perfect.

To understand how this virtualization setup works, let’s break it down:

  • KVM provides hardware-assisted virtualization through the Linux kernel.
  • QEMU provides hardware emulation and can use KVM to accelerate virtual machines.
  • libvirt provides tools and APIs for managing virtual machines, storage and networking.
  • Virt-Manager is a graphical interface for managing virtual machines through libvirt.

With KVM hardware acceleration and VirtIO devices, virtual machines can achieve performance close to native hardware for certain workloads. Actual performance depends on the hardware, guest operating system and VM configuration.

VirtualBox also supports hardware-assisted virtualization, so KVM isn’t automatically faster in every situation.

If you’re planning on playing demanding games inside a Windows VM, you’ll probably need GPU passthrough. That’s a separate topic and won’t be covered here.

At the end of the day, all of these are just tools. Use whichever one fits your needs.

ALSO READ: HOW TO: Create Disposable VMs in VirtualBox, GNOME Boxes and KVM/QEMU/Virt-Manager

1. Check Hardware Virtualization Support

The first thing you need to do is check whether hardware virtualization is available. On Intel processors, this is called VT-x. On AMD processors, it’s called AMD-V or SVM.

Open a terminal and run:

LC_ALL=C lscpu | grep Virtualization

Checking CPU virtualization support using lscpu on Linux

You can also check the CPU flags directly:

grep -E '(vmx|svm)' /proc/cpuinfo

If neither command produces the expected output, check your BIOS or UEFI settings. Hardware virtualization may be disabled, unavailable, or not exposed to your current operating system if you’re already running inside a virtual machine.

Next, check whether the KVM device is available:

ls -l /dev/kvm

If the device doesn’t exist, check your firmware settings and whether the appropriate KVM kernel modules are loaded.

2. Install KVM, QEMU and Virt-Manager

The installation instructions below are primarily intended for Arch Linux and compatible Arch based distributions running systemd. Package names and service configuration may differ on other distributions.

Install the Required Packages

sudo pacman -Syu qemu-desktop libvirt virt-manager dnsmasq nftables edk2-ovmf

These packages provide the desktop virtualization stack, graphical management tools, virtual networking and UEFI firmware for virtual machines.

If you already have a customized firewall configuration, check the Arch Wiki libvirt documentation for the appropriate networking backend.

For virtual machines that require a virtual TPM, such as Windows 11, you can also install:

sudo pacman -S swtpm

Enable libvirt

For a new installation using Arch’s traditional libvirt daemon setup, enable socket activation:

sudo systemctl enable --now libvirtd.socket virtlogd.socket

Verify that the libvirt socket is active:

systemctl status libvirtd.socket

Libvirt is gradually transitioning from its traditional daemon to separate modular daemons. If your system already uses services such as virtqemud and virtnetworkd, retain that configuration instead of enabling both daemon architectures.

Check User Permissions

Arch Linux normally uses Polkit to authorize access to libvirt’s system connection. Users belonging to the wheel group can generally authenticate using their own password through a Polkit authentication agent.

Check your existing group membership:

groups

You do not need to add your user to a group called libvirtd. If you specifically want group based authorization, follow the libvirt authentication documentation.

Users of minimal window managers may need to install and start a Polkit authentication agent.

Don’t run Virt-Manager itself as root.

Verify the Installation

Check the virtualization capabilities of your host:

sudo virt-host-validate qemu

Some warnings, particularly those related to hardware passthrough or optional security technologies, may not prevent ordinary virtual machines from working.

Check that you can connect to libvirt:

virsh -c qemu:///system list --all

If everything is working, you should see a list of virtual machines. On a fresh installation, this list will be empty.

Configure the Default Virtual Network

Check whether the default virtual network is available:

sudo virsh -c qemu:///system net-list --all

If the default network exists but is inactive, start it:

sudo virsh -c qemu:///system net-start default

Configure it to start automatically:

sudo virsh -c qemu:///system net-autostart default

This network normally provides NAT and DHCP, allowing virtual machines to access the network through the host computer.

If the network is missing entirely, or it fails to start, consult the libvirt networking documentation.

3. Create a Virtual Machine Using Virt-Manager

Now you should be ready to go. Open Virt-Manager from your application launcher or run:

virt-manager

Make sure you’re connected to the local QEMU/KVM system connection.

Virt-Manager main window with the QEMU KVM connection

The screenshots in this walkthrough are from the original 2022 article. Some interface elements may look different in newer versions.

Step 1: Create a New Virtual Machine

Assuming you’ve already downloaded the ISO image of the operating system you want to install, go to File > New Virtual Machine or click the new virtual machine button below the menu bar.

Select Local install media and click Forward.

Selecting local installation media in Virt-Manager

Step 2: Select the ISO Image

Click Browse to choose the ISO image.

Selecting an operating system ISO in Virt-Manager

Click Browse Local and locate the ISO file you’ve downloaded.

Browsing for a local ISO image

Virt-Manager should attempt to detect the operating system automatically.

If detection fails, disable automatic detection and select the appropriate operating system manually.

In the original demo, I’m installing EndeavourOS. Since EndeavourOS is based on Arch Linux, I selected Arch Linux as the operating system profile.

Selecting Arch Linux as the operating system profile for EndeavourOS

Step 3: Configure CPU and RAM

On the next screen, specify how much RAM and how many virtual CPUs you want to allocate to the virtual machine.

Configuring virtual CPUs and memory in Virt-Manager

For a typical Linux desktop VM, 2 to 4 virtual CPUs and 4 to 8 GB of RAM are reasonable starting points, assuming your host computer has sufficient resources.

Adjust these values according to the guest operating system’s requirements, and leave enough resources available for your host.

Step 4: Configure Storage

Set the amount of storage space you want to allocate to your virtual machine.

Configuring virtual disk storage in Virt-Manager

Virt-Manager commonly uses QCOW2 disk images. These can grow as the guest writes data and support features such as snapshots.

Remember that a dynamically allocated disk can eventually consume its full configured capacity.

Step 5: Review and Install

You’ve arrived at the last screen. Review the summary of your virtual machine.

Reviewing virtual machine configuration before installation

If everything looks right, click Finish to begin the installation.

Booting the EndeavourOS installer inside a virtual machine

Optional: Customize Before Installation

On the summary screen, you also have the option to select Customize configuration before install.

This allows you to configure virtual hardware, firmware, CPU settings, storage controllers, display devices and networking before starting the VM.

Advanced virtual hardware configuration in Virt-Manager

For modern guest operating systems, UEFI firmware and VirtIO devices are generally good choices when supported.

Once you’re done, click Begin Installation and follow the guest operating system’s installation process.

That’s it! Congrats. You’re running your first VM.

4. Troubleshooting, Tips and Tricks

As I’ve said before, no virtualization tool is perfect. It would be a shame to give up on KVM, QEMU and Virt-Manager over a few minor details.

Fixing Display Resolution and Automatic Resizing

Display resolution is always a pet peeve of mine. Some operating systems look just right out of the box. Others need some tweaking.

If your VM uses SPICE graphics, install the SPICE guest agent inside the guest operating system.

For an Arch Linux guest:

sudo pacman -S spice-vdagent

For a Debian or Ubuntu guest:

sudo apt install spice-vdagent

Restart the guest session if necessary.

While the VM is running, go to View > Scale Display > Auto resize VM with window.

Enabling automatic virtual machine display resizing

If automatic resizing doesn’t work, check the VM’s virtual hardware configuration and make sure the appropriate graphics device and SPICE agent channel are configured.

Virtio graphics is generally a good starting point for modern Linux guests. QXL may still be useful in certain older SPICE configurations.

If you’re using an X11 desktop session, you can also inspect available display outputs using:

xrandr

Then adjust the appropriate output. For example, if your output is named Virtual-1:

xrandr --output Virtual-1 --auto

This command is specific to X11 and is not a general solution for Wayland sessions.

I’ve also covered guest display configuration in the GNOME Boxes tutorial.

5. Sharing Files Between Host and Guest

Copying and pasting text between your host and guest can work through SPICE and the appropriate guest agent. Sharing files, however, is a different story.

Drag and drop support depends on the display protocol, guest operating system and installed guest tools.

For a permanent shared directory between a Linux host and a modern Linux guest, VirtioFS is a better option than the older 9p filesystem method used in the original version of this tutorial.

Install VirtioFS Support

On your Arch Linux host, install:

sudo pacman -S virtiofsd

Your Linux guest also needs a kernel with VirtioFS support, which is available in modern Linux kernels.

Create a Shared Folder

On your host computer, create a dedicated directory:

mkdir -m 700 ~/VM-Share

You can use another location if you prefer.

Don’t make your shared folder writable by everyone using chmod 777. VirtioFS respects filesystem permissions, and you may need to configure ownership, user IDs or access control lists to allow the intended users to access the directory.

For a straightforward system connection setup, matching the numeric user ID of your host and guest accounts can simplify permissions.

Run the following command on both systems to check:

id -u
id -g

Configure VirtioFS in Virt-Manager

Shut down the virtual machine completely.

Open its virtual hardware details and follow these steps:

  1. Select Memory and enable shared memory.
  2. Click Add Hardware.
  3. Select Filesystem.
  4. Select virtiofs as the driver.
  5. Set the source path to the full path of your host’s VM-Share directory.
  6. Set the target path to hostshare.
  7. Save the configuration and start the VM.

The target path is actually a mount tag, not a directory path inside the guest.

For additional configuration details, check the official libvirt VirtioFS documentation.

Mount the Shared Folder Inside the Guest

Once the Linux guest has booted, open a terminal and run:

sudo mkdir -p /mnt/hostshare
sudo mount -t virtiofs hostshare /mnt/hostshare

You can now access the shared directory at:

/mnt/hostshare

If you can mount the directory but cannot write to it, check filesystem ownership and permissions on the host rather than granting unrestricted access.

Automatically Mount the Shared Folder

First, make sure the manual mount works correctly.

Then back up the guest’s fstab file:

sudo cp /etc/fstab /etc/fstab.backup

Open it for editing:

sudo nano /etc/fstab

Add the following entry:

hostshare /mnt/hostshare virtiofs defaults,nofail 0 0

Save the file and test the configuration:

sudo umount /mnt/hostshare
sudo mount -a
findmnt /mnt/hostshare

The shared folder should now mount automatically when the guest starts.

Security note: A writable shared directory allows the guest to modify or delete files on the host within that directory. Only share files you intend the guest to access. Avoid sharing your entire home directory with untrusted virtual machines.

Also, files shared through VirtioFS are not included in normal libvirt VM snapshots. Restoring a VM snapshot will not restore the contents of your shared directory.

6. Passing USB Devices to the Guest

If you don’t want to configure a shared folder, passing USB devices such as flash drives to the guest can be another option.

With a compatible SPICE configuration and USB redirection enabled, plug in your USB device, go to Virtual Machine > Redirect USB Device and choose the device from the list.

USB device redirection menu in Virt-Manager

Selecting a USB device to redirect to the virtual machine

If the option is unavailable, check whether your VM has the appropriate USB controller and redirection devices configured.

Alternatively, you can shut down the virtual machine and add a USB Host Device through the virtual hardware configuration.

Don’t access the same USB storage device from both the host and guest simultaneously. Safely unmount it before transferring control between systems.

7. Converting VirtualBox VMs to Use with Virt-Manager

Now everything so far is great, but what if you’ve already got a lot of virtual machines inside VirtualBox?

You don’t necessarily have to reinstall everything. QEMU includes a utility called qemu-img that can convert VirtualBox VDI disk images to QCOW2.

Prepare the Original Virtual Machine

Completely shut down the VirtualBox guest before converting its disk. Do not convert a disk belonging to a running or suspended virtual machine.

Make a backup of the original virtual machine.

If your VM uses snapshots, create a full clone of its current state in VirtualBox first. Converting only the original VDI file may exclude changes stored in snapshot images.

Convert VDI to QCOW2

Open a terminal and navigate to the directory containing the VDI image.

Run:

qemu-img convert -p -f vdi -O qcow2 "Endeavour.vdi" "Endeavour.qcow2"

Replace the filenames with those of your actual virtual disk.

Depending on the size of the virtual machine and your hardware, this process may take a while.

Converting a VirtualBox VDI disk image to QCOW2 using qemu-img

Check the resulting disk image:

qemu-img info "Endeavour.qcow2"

If you’re using the standard libvirt system storage pool, move the converted image into its storage directory:

sudo mv -i "Endeavour.qcow2" /var/lib/libvirt/images/

The interactive option prevents silently overwriting an existing image. Choose a unique filename if a disk with the same name already exists.

Import the Converted Disk

Open Virt-Manager and create a new virtual machine. Instead of selecting Local install media, choose Import existing disk image.

Importing an existing virtual disk image into Virt-Manager

Select the converted QCOW2 image.

Selecting the converted QCOW2 disk from the libvirt storage pool

Continue configuring the VM as normal.

Try to match the original VM’s firmware mode. If the VirtualBox guest used UEFI, configure the new virtual machine to use UEFI as well.

Remember that you’re converting the disk image, not the entire virtual machine configuration. VirtualBox hardware settings and snapshots are not automatically transferred.

Windows guests may require additional storage drivers, including VirtIO drivers, before they can boot using VirtIO storage controllers.

Keep the original VirtualBox VM until you’ve confirmed that the converted VM boots correctly and all important data is accessible.

8. Useful libvirt Commands

You can also manage your virtual machines directly from the terminal using virsh.

List all virtual machines:

virsh -c qemu:///system list --all

Start a virtual machine:

virsh -c qemu:///system start VM_NAME

Shut down a virtual machine:

virsh -c qemu:///system shutdown VM_NAME

Automatically start a VM when the host starts:

virsh -c qemu:///system autostart VM_NAME

Disable automatic startup:

virsh -c qemu:///system autostart --disable VM_NAME

Replace VM_NAME with the actual name of your virtual machine.

Final Thoughts

That’s pretty much it. KVM, QEMU, libvirt and Virt-Manager provide a powerful virtualization environment that integrates directly with Linux.

It’s not necessarily the perfect solution for everyone, but it offers considerable flexibility when it comes to virtual hardware, networking, storage and automation.

I’ll say it again: all of these are just tools. Use them as such.

Useful Resources

Support FSMdotCOM on Liberapay