Hi!
Since I use NixOS, I started loving systemd a lot and using it extensively.
So I wanted to give a try to the new systemd-vmspawn
utility, to imperatively run a VM on a NixOS 24.11 desktop.
I first imported a debian image:
sudo importctl pull-raw -m --verify=no https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.raw debian-12
Then I tried to start a VM:
sudo systemd-vmspawn -i /var/lib/machines/debian-12.raw
But got the following error:
Failed to find OVMF config: No such file or directory
I found nothing online about using
systemd-vmspawn
on NixOS.
I think ideally there should be a NixOS option like virtualisation.systemd-vmspawn.enable
to configure what’s necessary for systemd-vmspawn
to work out of the box.
I’d be happy to open a PR for that, but I don’t know what’s wrong! I don’t know much about the low-level side of virtual machines.
Brain log:
- The error seems to occur here in systemd-nspawn.
- I saw that this option exists:
virtualisation.efi.OVMF
to change the OVMF package, but no option to actually import this package or something. - I suspect that some firmware or virtualisation backend like QEMU is missing.
- There is no optional QEMU dependency in the systemd package.
sudo systemd-vmspawn --firmware=list
shows nothing, which should indicate that it doesn’t find any EFI firmware.- No difference when running the same command in a
nix-shell -p qemu
shell. - No difference when activating
virtualisation.libvirtd
enabled (it’s dumb but I had to try)
Side note:
systemd-firstboot
is not available in NixOS and I have no idea why. Surely because no one tried to start systemd-vmspawn
so no one needed it.