Testing Lomiri using a QEMU VM
This tutorial describes how to install and test the latest Lomiri desktop packages from Debian unstable inside a QEMU VM. It has been tested using the qemu package from Debian Trixie but should also work with newer versions.
First, create a script debian-lomiri-vm.sh with the following contents:
1 #!/bin/sh
2
3 PATH=/bin:/usr/bin
4 LC_ALL=C
5
6 image=debian-lomiri.qcow2
7 backing_image=debian-lomiri-backing.qcow2
8 usb_image=debian-lomiri-usb.raw
9 iso="$1"
10
11 [ -f "${image}" ] || \
12 qemu-img create -q -o "backing_file=${backing_image},backing_fmt=qcow2" \
13 -f qcow2 "${image}"
14 [ -f "${usb_image}" ] || \
15 qemu-img create -q -f raw "${usb_image}" 1G
16
17 exec env QEMU_AUDIO_DRV=spice qemu-system-x86_64 \
18 -nodefaults \
19 -no-user-config \
20 -enable-kvm \
21 -machine q35 \
22 -cpu host \
23 -smp 2 \
24 -m 4G \
25 -object rng-random,id=rng0,filename=/dev/urandom \
26 -device virtio-rng-pci,rng=rng0 \
27 -netdev user,hostfwd=tcp:127.0.0.1:2222-:22,id=netdev0 \
28 -device virtio-net,netdev=netdev0 \
29 -device virtio-vga-gl \
30 -device virtio-serial \
31 -display spice-app,gl=on \
32 -chardev spicevmc,id=vdagent,debug=0,name=vdagent \
33 -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
34 -device virtio-keyboard-pci \
35 -device virtio-tablet-pci \
36 -device intel-hda \
37 -device hda-duplex \
38 -audio spice \
39 -device nec-usb-xhci,id=xhci \
40 -drive "if=virtio,format=qcow2,file=${image}" \
41 ${iso:+-cdrom "${iso}"} \
42 ${usb_image:+-drive if=none,id=usbdrive,format=raw,file="${usb_image}"} \
43 ${usb_image:+-device usb-storage,bus=xhci.0,drive=usbdrive} \
44 -monitor stdio
This script creates a backing file for a virtual harddisk image and a virtual USB drive which can be used to test removable media. It runs QEMU with support for OpenGL, Audio and forwards port 2222 on localhost to port 22 in the guest. Graphical output is displayed via the SPICE protocol using virt-viewer. An ISO image given as the first argument will be inserted into the virtual CDROM drive.
Next create a virtual harddrive image with sufficient space:
1 qemu-img create -f qcow2 debian-lomiri.qcow2 50G
Note that by default all changes will be written to a backing file created by the script called debian-lomiri-backing.qcow2 and not the actual image debian-lomiri.qcow2. This allows for an easy rollback by simply deleting the backing file during testing.
Changes can be made permanent by committing the changes from the backing file to the underlying image file by running the following command:
1 qemu-img commit debian-lomiri.qcow2
Next download the latest Debian testing installation image from wget https://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso and start the installation by running the above script:
1 ./debian-lomiri-vm.sh debian-testing-amd64-netinst.iso
Install Debian testing without a desktop environment but with a SSH server. After the installation, reboot the VM and upgrade to Debian unstable.
Then install the Lomiri desktop using:
This point may be a good opportunity to shut down the VM and to commit all changes to the underlying disk image as described above.
The VM is now ready for testing Lomiri-related packages. Locally built packages can be easily copied into the VM using scp:
1 scp -P 2222 <package>.deb <username>@127.0.0.1
In order to revert any changes, shut down the VM and remove the image backing file.
