Subject: bug#62040: Support for running guix system vm images for different architectures

From: Nathan Dehnel <[email-masked]>
Date: Tue, 7 Mar 2023 17:07:39 -0600

I tried to build a guix vm for aarch64 on x64:

guix system vm --target=aarch64-linux-gnu
/home/nathan/guix-config/guixaarch64vm/config.scm

I copied the script out of the store and removed -enable-kvm because
qemu doesn't support it if the architectures are different:

#!/gnu/store/d99ykvj3axzzidygsmdmzxah4lvxd6hw-bash-5.1.8/bin/sh
exec /gnu/store/wqs83j00b2dd1481qwjw2hk49q7yrgb9-qemu-7.2.0/bin/qemu-system-aarch64
-kernel /gnu/store/yj98lqgxb17i8
pqm4rmj32ix7861fqy0-linux-libre-6.1.14/Image -initrd
/gnu/store/9pcg7jskx5ahz2gpnzsl1mim6akr2jly-system/initrd -appe
nd "root=/dev/vda1
gnu.system=/gnu/store/xqqq1xq7wwlsafdj104plipm66pwnb5w-system
gnu.load=/gnu/store/xqqq1xq7wwlsafd
j104plipm66pwnb5w-system/boot modprobe.blacklist=usbmouse,usbkbd
quiet" -no-reboot -object rng-random,filename=/dev/
urandom,id=guix-vm-rng -device virtio-rng-pci,rng=guix-vm-rng -virtfs
local,path="/gnu/store",security_model=none,mo
unt_tag="TAGjoptajej2oynju6yvboauz7pl6uj" -drive
file=/gnu/store/h5icgvql06yj4r0fqhkhl4y68wrr7pah-disk-image,format=
raw,if=virtio,cache=writeback,werror=report,readonly=on -m  512 "$@"

I tried to run it with these options:

./8vigmmi4gll68cb1648q3rwsyjfvzpkm-run-vm.sh -nographic -machine
virt,gic-version=max -m 512M -cpu max -smp 4 -netdev
user,id=vnet,hostfwd=:127.0.0.1:0-:22 -device
virtio-net-pci,netdev=vnet
GC Warning: pthread_getattr_np or pthread_attr_getstack failed for main thread
GC Warning: Couldn't read /proc/stat
Welcome, this is GNU's early boot Guile.
Use 'gnu.repl' for an initrd REPL.

loading kernel modules...
loading '/gnu/store/xqqq1xq7wwlsafdj104plipm66pwnb5w-system/boot'...
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure open-file: No such file or directory:
"/gnu/store/xqqq1xq7wwlsafdj104plipm66pwnb5w-system/boot"

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
GNU Guile 3.0.9
Copyright (C) 1995-2023 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)>

Can guix system vm support running non-native vms? Or does it?