Install KVM hypervisor

On the headless hypervisor, do:

pacman -S qemu libvirt edk2-ovmf
systemctl enable libvirtd.service

And for virt-manager to work remotely, you also need:

gpasswd -a matelakat libvirt
pacman -S openbsd-netcat

For Arch bootstraping features you will also need:

pacman -S arch-install-scripts rsync dosfstools

Disk configuration

mkdir /mnt/data/virt-storage
chown root:libvirt /mnt/data/virt-storage/
chmod g+w /mnt/data/virt-storage/

Network configuration

systemctl disable dhcpcd.service
systemctl enable systemd-networkd.service
cat /etc/systemd/network/ethernet.network

cat /etc/systemd/network/vmbr.netdev
cat /etc/systemd/network/vmbr.network


UEFI Firmware

KVM is ready to use with UEFI, make sure you customise the virtual machine before starting the installation and select UEFI

Create Qcow2 Disk Image

qemu-img create -f qcow2 /data/scratch/disks/disk.qcow2 10G

Mount Qcow2

sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 /data/scratch/disks/disk.qcow2

Once you are done with that device:

# qemu-nbd --disconnect /dev/nbd0

Guest Setup

You'll need the package to have copypaste between your host and guest

pacman -S spice-vdagent

To support 4k resolution, you'll need

cvt 3840 2160
xrandr --newmode
xrandr --addmode Virtual-1 3840x2160_60.00
xrandr --output Virtual-1 --mode 3840x2160_60.00

Export a Block Device through Network

On the server you would need to make sure you let port 10809 through your firewall, as that is the default port for nbd

Then you start a serving a qcow2 image in a read-only fashion by:

# modprobe nbd max_part=8
# qemu-nbd path-to-disk.qcow2 -r -b

Note that I explicitly specified which interface to bind to.

On the client machine:

# nbd-client /dev/nbd0

Then you will be able to access the device /dev/nbd0