- related to Emacs, Guix
- under Blog
- follows Try Guix System in QEMU Within Emacs
User group
To use KVM, the current user needs to be in the kvm group:
(user-account (name "you") (group "users") (supplementary-groups '("kvm" ;; ... other groups )))
UEFI
In Guix, OVMF files are provided by the package ovmf-x86-64.
export OVMF=/gnu/store/$(ls -F /gnu/store | grep 'ovmf-x86-64.*/' | head -n 1) cp $OVMF/share/firmware/ovmf_vars_x64.bin . chmod +x ovmf_vars_x64.bin
qemu-bridge-helper
The cookbook (guix-cookbook#Network bridge for QEMU) described how to make it work, but the information at the time of writing this post is somewhat incomplete.
The first thing is to add it to the privileged program list:
(privileged-program
(program (file-append qemu "/libexec/qemu-bridge-helper"))
(setuid? #t))
This will add it to /run/privileged/bin/.
In order to use it properly, it needs to be specified in the command line options, as:
-nic bridge,br=br0,helper=$(which qemu-bridge-helper),model=virtio-net-pci
Bridge
Do what "Creating a network bridge interface" section says. However, I believe the filename is "/etc/qemu/bridge.conf".
Installation
qemu-img create -o nocow=on -f qcow2 archlinux.cow 20G qemu-system-x86_64 -m 4096 -smp 1 -enable-kvm \ -nic bridge,br=br0,helper=$(which qemu-bridge-helper),model=virtio-net-pci -boot menu=on,order=d \ -drive file=archlinux.cow \ -drive media=cdrom,readonly=on,file=archlinux-2026.02.01-x86_64.iso \ -drive if=pflash,format=raw,readonly=on,file=$OVMF/share/firmware/ovmf_code_x64.bin \ -drive if=pflash,format=raw,file=ovmf_vars_x64.bin \ -vga virtio
Run
qemu-system-x86_64 \ -enable-kvm -m 4096 -smp 1 \ -nic bridge,br=br0,helper=$(which qemu-bridge-helper),model=virtio-net-pci \ -device virtio-blk,drive=myhd \ -drive if=none,file=archlinux.cow,id=myhd \ -drive if=pflash,format=raw,readonly=on,file=$OVMF/share/firmware/ovmf_code_x64.bin \ -drive if=pflash,format=raw,file=ovmf_vars_x64.bin \ -vga virtio