A comprehensive guide on how to install and use virt-manager virtual machine emulator in Ubuntu and other Linux systems.
The virt-manager application or package uses the libvirt library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines.
It is primarily used for KVM VMs but can support other hypervisors as well, such as Xen, and LXC.
The user interface provides a summary view of all VMs their status, CPU usages, LIVE performance graph of running VMs, and resource utilization statistics.
There are other popular Virtual machine managers available such as GNOME Boxes and Oracle Virtual box. GNOME Boxes is easy, but it’s buggy and depends heavily on GTK and GNOME-related packages. Oracle Virtual Box is good, but I feel it is unnecessary and complex and has a complicated UI.
But the virt-manager is super easy and can be used on any Linux distribution.
When you install the virt-manager package, it comes with five components.
virt-install: Command-line utility to provision OS
virt-viewer: The UI interface with graphical features
virt-clone: Command-line tool to close existing inactive hosts
virt-xml: Command-line tool for easily editing libvirt domain XML using virt-install’s command-line options.
virt-bootstrap: Command tool providing an easy way to set up the root file system for libvirt-based containers.
- How to install virt-manager
- Usage guide after installation
- Disk storage details
- How to delete a virtual machine
- Various troubleshooting
How to Install virt-manager
The virt-manager is in most of the Linux distribution’s official repo. You can run the below commands via the terminal to install virt-manager for respective systems.
Debian, Ubuntu, Linux Mint, elementary and other Ubuntu-based distributions
sudo apt-get install virt-manager
sudo dnf install virt-manager
pacman -S virt-manager
After installation, you can find the option Virtual Machine Manager in the application menu.
How to Use virt-manager
Open virt-manager from the application menu. If you see an error as libvirtd not running or Not Connected, then check the Troubleshooting section at the end of this guide.
After opening, right-click on the QEMU/KVM and click New.
Select Local Install Media, which is for the .ISO images. You can choose other options as well if you want.
In the next window, click browse and then Browse Local.
Select the .ISO file and select the Other Operating system.
Keep the Memory as 1024 MB and CPU 1 Core. Or you can change it as per your need.
In the next window, uncheck the Enable Storage for this virtual machine.
Give the name of your virtual machine so that you can identify it later on. For this guide, I am using Linux Lite, so I added Linux-lite as VM name.
If all goes well, you can see the virtual machine is up and running for you.
Now you can play around with the newly created VM via virt-manager.
Where does the virtual machine images stored by virt-manager?
When you create a virtual machine, the images are stored on the disk. Different virtual machine software stores them in different places. The virt-manager stores them in
/var/lib/libvirt/images directory. See example screenshots below.
How to delete a virtual machine image in virt-manager?
The virtual machine concept is fantastic in a way that whenever you want, you can delete the image and start over. Or do a different thing or two. So deleting a virtual machine is straightforward. Here’s how.
- From the main window, make sure you see the list of virtual machines.
- Right-click, and from the context menu, select Delete. In the next pop-up, it will warn you to delete the disk images. If you want to clear up everything in your disk, then select Delete to delete the virtual machine.
1. Unable to connect to libvirt qemu:///system
When launching virt-manager, if you see the below error, follow the steps described below.
Unable to connect to libvirt qemu:///system
Verify that the 'libvirtd' daemon is running.
First, ensure that the libvirtd daemon is running with the below command.
sudo systemctl start libvirtd
Close the application if opened from the menu.
Then open a terminal and add your user account to the libvirt group. In the below command
debugpoint is the user name. Replace it with your own user.
sudo adduser debugpoint libvirt
Make sure to restart the daemon
sudo systemctl restart libvirtd
You can check whether the user is added to the group via id command as below.
You should not see any error as above or.’
QEMU/KVM - Not connected'.
2. Error starting domain: Requested operation is not valid: network ‘default’ is not active
The libvirt package virtual network is called “default”, and it should start when libvirt daemon (libvirtd) is marked to autostart. But if for some reason it fails to start, it gives the following error.
Error starting domain: Requested operation is not valid: network 'default' is not active
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/asyncjob.py", line 65, in cb_wrapper
callback(asyncjob, *args, *kwargs) File "/usr/share/virt-manager/virtManager/asyncjob.py", line 101, in tmpcb callback(args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 57, in newfn
ret = fn(self, *args, **kwargs)
File "/usr/share/virt-manager/virtManager/object/domain.py", line 1329, in startup
File "/usr/lib/python3/dist-packages/libvirt.py", line 1353, in create
raise libvirtError('virDomainCreate() failed')
libvirt.libvirtError: Requested operation is not valid: network 'default' is not active
To fix this, start the network from the command line using the below command.
sudo virsh net-start default
3. Scaling and Display configuration
More often than not, you find the resolution problem in Virtual Machine Manager. The guest OS resolution is not properly detected for various reasons, creating larger displays/icons in the guest OS. It doesn’t match your Host OS resolution. There are various ways to fix this. If you want to scale your guest OS resolution, use the following method.
Video Model = virtio
View > Scale Display > Always
- Now, change the resolution in the guest OS.
I hope this guide helps you to install and use virt-manager in Linux. Drop a comment if you are having trouble.