sodcalculator

10 Tech How-To

How to Use Virtual Machine Manager on Linux

Guide 10-33303 · Updated · Step by step

Virtual Machine Manager (virt-manager) is a free, graphical tool for creating and managing virtual machines on Linux. It uses the libvirt API to work with KVM, QEMU, and Xen hypervisors. This guide walks you through installing virt-manager, creating your first VM, and managing it day-to-day.

What You’ll Need

  • A Linux distribution with a desktop environment (GNOME, KDE, etc.)
  • Root or sudo access to install packages and run virt-manager
  • An ISO image of the operating system you want to install (e.g., Ubuntu, Debian, Windows)
  • At least 10 GB of free disk space (more if you plan to install a large OS)
  • CPU with virtualization extensions (Intel VT-x or AMD-V) — check with grep -E -c '(vmx|svm)' /proc/cpuinfo; a number greater than zero means it’s supported

Step-by-Step

  1. Install virt-manager. On Debian/Ubuntu, run sudo apt install virt-manager. On Fedora, use sudo dnf install virt-manager. On Arch, sudo pacman -S virt-manager. This installs the GUI and the libvirt daemon.
  2. Start the libvirt service. Run sudo systemctl enable --now libvirtd (or libvirtd.service on some systems). Check that it’s active with systemctl status libvirtd.
  3. Add your user to the libvirt group. This avoids needing sudo every time. Run sudo usermod -aG libvirt $(whoami), then log out and back in (or reboot) for the group change to take effect.
  4. Launch Virtual Machine Manager. From your application menu, search for “Virtual Machine Manager” or run virt-manager in a terminal. It opens with a list of connections; the default “QEMU/KVM” connection should appear.
  5. Create a new VM. Click the “Create a new virtual machine” button (the monitor with a plus icon) or go to File > New Virtual Machine.
  6. Choose the installation method. Select “Local install media (ISO image or CDROM)” and click Forward. For network installs, pick “Network Install” and enter the URL.
  7. Browse for your ISO. Click “Browse” and navigate to your ISO file. If it doesn’t appear, click “Browse Local” to open a file picker. Select the ISO and click Forward.
  8. Set memory and CPU. Choose how much RAM (in MB) and how many CPU cores to allocate. A good starting point is 2048 MB RAM and 2 CPUs for a desktop OS. Click Forward.
  9. Create a virtual disk. Set the disk image size (e.g., 20 GB). Choose “Enable storage for this virtual machine” and select a file location. The default format is qcow2, which grows as you use it. Click Forward.
  10. Name and finalize. Give the VM a name (e.g., “Ubuntu VM”). Check the “Customize configuration before install” box if you want to tweak hardware (like adding a second network adapter). Click Finish.
  11. Install the OS. The VM window opens and boots from the ISO. Follow the normal installation process for your OS. When done, the VM reboots and you’re ready to use it.
  12. Manage the VM. In the main window, right-click a VM to start, pause, shut down, or clone it. Use the toolbar buttons to send Ctrl+Alt+Del, take screenshots, or change display settings.

Common Mistakes

  • Forgetting to enable virtualization in BIOS. If virt-manager says “KVM is not available,” your CPU extensions are disabled. Reboot, enter BIOS/UEFI, and enable Intel VT-x or AMD-V.
  • Not adding your user to the libvirt group. You’ll get permission errors when trying to create a VM. Always log out and back in after the usermod command.
  • Using too little disk space. A 5 GB disk is barely enough for a minimal Linux install; for Windows, you’ll need at least 30 GB. Set a realistic size from the start.
  • Allocating too much RAM. If you give the VM more RAM than your host has free, the host will swap and become unusable. Keep at least 2 GB for the host.
  • Forgetting to install the QEMU guest agent. Without it, some features like graceful shutdown and clipboard sharing won’t work. Install the qemu-guest-agent package inside the VM.

Tips

  • Use the default qcow2 disk format. It’s compact and supports snapshots. Avoid raw format unless you need maximum performance.
  • Create snapshots before major changes. In the VM toolbar, click the snapshot icon (a camera) to take a snapshot. You can revert to it later if something breaks.
  • Enable copy/paste between host and guest. Install the SPICE guest tools (for Linux guests) or virtio-win drivers (for Windows). This enables seamless clipboard sharing.
  • Use virtio for disk and network devices. When customizing the VM, change the disk bus and NIC model to virtio. This gives much better performance than the default IDE/e1000.
  • Clone a VM instead of reinstalling. Right-click a VM and select “Clone” to make a copy. This saves time when you need multiple similar VMs.

Troubleshooting

  • “KVM is not available” error. Check if virtualization is enabled in BIOS. Also verify the kvm module is loaded with lsmod | grep kvm. If not, run sudo modprobe kvm_intel (or kvm_amd).
  • Permission denied when starting libvirtd. Make sure the service is running: sudo systemctl start libvirtd. If you get “Failed to connect socket to ‘/var/run/libvirt/libvirt-sock’”, your user isn’t in the libvirt group. Log out and back in.
  • VM won’t boot from ISO. Check that the ISO is correctly attached. In the VM window, click the “Virtual Machine” menu, then “IDE CD-ROM 1”, and verify the ISO path. Also check the boot order in the BIOS settings (press F2 during boot).
  • No network in the VM. The default NAT network should work. If not, open the VM’s network adapter settings and change the model to virtio. If that fails, check that the default network is active: sudo virsh net-start default.
  • Poor performance. Make sure the CPU model is set to “host-passthrough” in the VM’s CPU settings. Also increase the video memory and enable 3D acceleration if needed.

Frequently Asked Questions

Can I run Windows in virt-manager?

Yes, but you’ll need to install the virtio drivers during Windows setup. When the installer asks for drivers, point it to the virtio-win ISO. Performance is good, but you must enable KVM and allocate enough resources.

How do I share files between host and guest?

Use a shared folder. In the VM’s hardware details, click “Add Hardware” and select “Filesystem”. Set the driver to “virtiofs”, the source path to a host folder, and the target path to a mount point in the guest. Then mount it inside the VM.

Can I run virt-manager without a desktop environment?

virt-manager is graphical, so it needs X11 or Wayland. If you only have a terminal, use virsh commands instead, or install virt-manager on a remote machine and connect to the libvirt daemon over SSH.

Is it safe to delete the VM’s disk image?

Deleting the disk image erases the VM permanently. If you want to keep the VM, use the “Delete” option in virt-manager, which asks if you want to delete the storage too. Always back up important VMs first.

Can I convert a VirtualBox VM to virt-manager?

Yes. Export the VM as an OVA file in VirtualBox, then import it in virt-manager via File > Import. Or use qemu-img convert to change the disk format from VDI to qcow2.

Why does my VM run slowly even with many cores?

Check that the CPU model is set to “host-passthrough” and that KVM is enabled. Also, avoid over-allocating cores; sometimes fewer cores with higher clock speed works better. Ensure the host isn’t under heavy load.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →