In early March I looked up how to run Android with KVM on Ubuntu, then searched for KVM, QEMU because the two names kept appearing together. My next question was more concrete: how can i install qemu on ubuntu with gui. By GUI I meant a graphical interface I could operate with a mouse. If I had a Fedora installation image, for instance, which window should I open to tell it to boot from that image?
On Ubuntu Desktop that window is Virtual Machine Manager, launched with virt-manager. On the afternoon of March 6 I opened Ubuntuās documentation and started the program a little over ten seconds later. The window appeared, but its QEMU/KVM connection reported a permission error. Before a Fedora desktop could appear in that window, I had to connect to the management service.1
What does virt-manager connect to?
For a Fedora VM, the Ubuntu system Iām using is the host, and the Fedora installation is the guest. When I allocate memory, create a disk, and click the start button, virt-manager passes those settings to the libvirt service on Ubuntu. libvirt saves the configuration and starts and stops VMs. QEMU provides the actual virtual CPU, disk, and display devices for Fedora. On computers that support hardware virtualization, QEMU can use KVM, the Linux kernelās virtualization facility, to execute guest code directly on the host CPU.23
On an Ubuntu 24.04 desktop with an Intel or AMD processor, for example, you can install the management interface and the service it connects to together. Then launch the window as your ordinary desktop user.21
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system virt-manager
virt-manager --connect qemu:///system
qemu:///system refers to VMs on this Ubuntu machine managed by the system service. If QEMU/KVM is already connected in the window and there are no machines underneath it, go ahead and click āCreate a new virtual machine.ā The list shows only machines that have already been created.1
Why do I get āPermission deniedā when the window opens?
When I opened the window on March 6, the summary said Unable to connect to libvirt qemu:///system. I expanded the details, and the last line showed where it had stopped:
Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
That path is the local endpoint through which the desktop program communicates with libvirt. When you see this error, first run id -nG in an Ubuntu terminal and check whether your current login session has the libvirt group. If itās missing, add the account that needs to manage VMs to the group.2
sudo adduser "$USER" libvirt
Log out of the Ubuntu desktop and log back in so that newly opened graphical programs get the group permissions too. Then run the following commands as an ordinary user. virsh is libvirtās command-line management tool and connects to the same address as the graphical window. If it lists column headers, the user can connect, even if the VM list is empty.2
virsh --connect qemu:///system list --all
virt-manager --connect qemu:///system
My command history also shows newgrp libvirt and sudo virt-manager. The first affects a new shell session, while programs opened from the desktop menu still inherit the old permissions. The second runs the manager as an administrator and doesnāt test whether an ordinary desktop user can connect. To verify the change, run the two commands above from the account you logged back into.
How do I boot Fedora from an ISO and install it on the virtual disk?
First get a Fedora Workstation ISO, an image of an installation disc. On a 64-bit Intel or AMD machine, choose the version with x86_64 in its filename. Iāll use the Fedora Workstation 41 Live image I had at the time. Live means you can start a working desktop directly from the installation medium.4
- Select the installation disc. In the main virt-manager window select the local QEMU/KVM connection, then File ā New Virtual Machine. Choose Local install media (ISO image or CDROM) in the first step, browse the local files, and select the downloaded
.iso. If the wizard fails to identify the OS, disable automatic detection and search for Fedora manually.5 - Allocate memory, CPUs, and disk space. If your host has enough resources, a starting point might be 4 GiB of RAM, two virtual CPUs, and a new 40 GiB virtual disk for Fedora. That disk is usually a file on Ubuntu, which the Fedora installer sees as its own hard drive. The ISO is the boot medium. The empty disk is the installation destination.5
- Start the live desktop. Give the VM a name such as
fedora, keep the default virtual network, and click Finish. Start Fedora Live in the VM window that opens. If you just want to try the desktop, you can use it now. - Keep the installed system. To retain installed software and files, launch the Fedora installer inside the live desktop and choose the virtual disk you just created as the destination. Shut down the VM once installation finishes. If it boots back to the installer, eject the ISO from the virtual optical drive in virt-managerās hardware details and boot from the hard drive. Next time, start the same machine from the main window to return to the installed system.14
On March 16, my Ubuntu system had a VM configuration named fedora.xml and a matching QEMU log. Those correspond to two actions in the management window: libvirt saves a machine named fedora when itās created, and QEMU runs it with that configuration when it starts. My records confirm the configuration and log, but donāt establish whether I installed the live desktop on the virtual disk that time.
Footnotes
-
Canonical. (n.d.). Virtual Machine Manager. Ubuntu Server documentation. Install virt-manager, Guest lifecycle. ā© ā©2 ā©3 ā©4
-
Canonical. (n.d.). Libvirt. Ubuntu Server documentation. Install libvirt, Ubuntu Server Guide, Libvirt installation, pp. 101ā102. ā© ā©2 ā©3 ā©4
-
QEMU Project. (2023). Introduction (v8.2.0). QEMU documentation. Virtualisation Accelerators, opening paragraph and support list. ā©
-
Fedora Project. (n.d.). Download Fedora Workstation 41. Fedora Websites. Archived Fedora 41 download page, description of live media. ā© ā©2
-
virt-manager contributors. (2022). createvm.ui (v4.1.0). GitHub. Installation media, memory, processor, and storage options in the new VM wizard. ā© ā©2