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
/mnt/data
/mnt/data/virt-storage
is used for storage of kvm artifactsmkdir /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
[Match]
Name=vmbr
[Network]
DHCP=ipv4
cat /etc/systemd/network/vmbr.netdev
[NetDev]
Name=vmbr
Kind=bridge
cat /etc/systemd/network/vmbr.network
[Match]
Name=enp0s31f6
[Network]
Bridge=vmbr
KVM is ready to use with UEFI, make sure you customise the virtual machine before starting the installation and select UEFI
:::bash
qemu-img create -f qcow2 /data/scratch/disks/disk.qcow2 10G
:::bash
sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 /data/scratch/disks/disk.qcow2
Once you are done with that device:
:::bash
# qemu-nbd --disconnect /dev/nbd0
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
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:
:::bash
# modprobe nbd max_part=8
# qemu-nbd path-to-disk.qcow2 -r -b 192.168.222.1
Note that I explicitly specified which interface to bind to.
On the client machine:
:::bash
# nbd-client 192.168.222.1 /dev/nbd0
Then you will be able to access the device /dev/nbd0