Skip to main content

Running virtual machines on PIE

Running virtual machines on machines rooms computers can be difficult. Because of the ephemere nature of the filesystem of these computers and the size of virtual machines, their usage can be very limited.

Some PIE images provide libvirt and QEMU with custom configuration to allow you to run virtual machines. As of writing of this page, only NixOS Majeures and NixOS SSSE provide this.

Getting started

Open virt-manager. On first startup, you need to add a connection. Go to File then Add connection. Select QEMU/KVM user session and click on Connect.

virt-manager add connection screenshot

Right-click on QEMU/KVM User session and go to Details. In the Storage tab, click on the + to add a storage pool. Add a storage pool called pool of type dir that points to /srv/libvirt-workdir.

caution

You must imperatively use this folder to store your VM disks and installation iso files.

danger

This folder is emptied after every reboot. This is very important: your virtual machine will be deleted after reboot.

The reasons why this setup is necessary are that you do not have enough space in your AFS to store VMs and it is too slow anyway. If you use a different folder than the one specified above, your VM storage will be stored in RAM which will cause space problems.

virt-manager add storage pool screenshot

Creating a VM

Get the system installation image that you want to use, for example Ubuntu's installation ISO and save it to /srv/libvirt-workdir.

Right-click on QEMU/KVM User session then New.

Select Local install media (ISO image or CDROM)

Select the downloaded ISO file. Normally, it should be in the pool storage pool (so in /srv/libvirt-workdir).

At the disk creation step, select Select or create custom storage. In Manage, select pool and add a new volume.

virt-manager add disk screenshot

Finally, before finalizing the VM installation, in Network selection select Bridge device... and enter virbr0.

virt-manager add network screenshot