Libvirt (license LGPL, https://libvirt.org) is one of the best and most flexible virtual machine environments. A graphic frontend for libvirt is the tool Virt-Manager. It can manage your virtual machines e.g. on a KVM/qemu server.
Interestingly there is a 3D driver in development called VirGL, it will use the host GPU and is not a complete GPU pass-trough.
Based on https://wiki.archlinux.org/index.php/Libvirt you need to do the following base setup to get libvirt up and running on a host machine.
$ sudo pacman -Sy libvirt qemu dnsmasq ebtables bridge-utils openbsd-netcat qemu-block-gluster
As defined in /etc/libvirt/qemu.conf and /etc/libvirt/libvirtd.conf defaults to nobody, libvirt and kvm, replace USERNAME with your user.
$ sudo gpasswd -a USERNAME libvirt $ sudo gpasswd -a nobody kvm
Then uncomment or comment the following lines in libvirtd.conf like in the example below.
$ sudo nano /etc/libvirt/libvirtd.conf unix_sock_group = "libvirt" unix_sock_ro_perms = "0770" unix_sock_rw_perms = "0770" auth_unix_ro = "none" auth_unix_rw = "none" #listen_tls = 0 #listen_tcp = 1 #auth_tcp=none
$ sudo nano /etc/conf.d/libvirtd LIBVIRTD_ARGS="" $ systemctl enable libvirtd.service $ systemctl start libvirtd.service
Then reboot or logout and login again.
Host and VM direct network
Libvirt on Btrfs
Before creating a new virtual machine, make sure to disable the copy on write feature on a Btrfs file system so that it behaves like a traditional file system and directly modifies files without creating a copy first:
sudo chattr +C -R /var/lib/libvirt/images
If files are created in that directory already, move them to first to another directory and then copy them again into this folder so that they get the +C added as well. you can see the actual attributes with this command:
sudo lsattr /var/lib/libvirt/images
Virt-Manager (license GPLv3+, https://virt-manager.org) is a good tool to manage local and remote virtual machines on a Qemu/KVM on libvirt.
sudo pacman -Sy virt-manager
If you have issues on KDE with ksshaskpass remembering passwords, run:
sudo ln -s /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass
Virt-Manager runs directly on Wayland.
Sadly Qt-Virt-Manager (https://github.com/F1ash/qt-virt-manager, GPLv2) development seems to be stalled, so there is no usable Qt version available. If you want, you can install it from AUR for testing. It runs natively on Wayland:
It works, but the qt5-remote–viewer doesn’t show any content, see bug https://github.com/F1ash/qt-virt-manager/issues/25.
Virt-Manager Unknown Disk Format
If you create in Virt-Manager a pool and it doesn’t work as of unknown format, then do it via the console. Example:
sudo virsh pool-define-as sdf disk - - /dev/sdf - /dev
Check, edit and compare to other pools, e.g. make sure the format type is gpt.
sudo virsh pool-edit sdf
Then you can start the partition in Virt-Manager and you can enable auto start if you want.
Additionally to Virt-Manager you can use Cockpit to manage virtual machines, read Cockpit – Server Monitoring & Management.
Qemu 2.12 deprecated GTK2 and SDL1 in favor of GTK3 and SDL2.
To use UEFI boot you must define it before creating the new virtual machine. Click on “Edit configuration before installation” and then select in the field firmware “”.
OVMF is the Tianocore open source UEFI firmware for qemu. It allows you to replace the grub with systemd-boot. At the boot you should see then the white Tianocore logo indicating UEFI support. As always, booting with UEFI is slower, the Tianocore needs 3 seconds for initialization, Linux needs less time to boot to a console.
$ sudo pacman -Sy ovmf $ sudo nano /etc/libvirt/qemu.conf nvram = [ "/usr/share/ovmf/x64/OVMF_CODE.fd:/usr/share/ovmf/x64/OVMF_VARS.fd" ]
If you have cloned a virtual machine (or copied the image), the following steps are recommended to get a unique system:
- Change hostname in /etc/hostname
- Check /etc/fstab for not existing or changed devices
- Check /etc/crypttab
- Check with ip a if your new machine uses IPv6, if yes make sure that the locally assigned IP address is unique on your local network. I got some /128 noprefixroute duplicate addresses, this can be fixed by assigning a new machine id:
rm -f /etc/machine-id dbus-uuidgen --ensure=/etc/machine-id rm /var/lib/dbus/machine-id dbus-uuidgen --ensure
For more details read: https://unix.stackexchange.com/questions/402999/it-is-ok-to-change-etc-machine-id