Create an arm* VM

Create a stretch/buster-elts armhf VM, to debug a failing package build or testsuite. This works from an amd64 host, but isn’t very useful, see limitations below and ARM local debug for a more practical native solution.

sudo apt install arch-test uidmap binfmt-support \
  qemu-system-arm qemu-user-static

DIST=stretch # or buster, bullseye, etc.
ARCH=armhf   # or arm64 (>= buster)
debvm-create -r $DIST -o $DIST-$ARCH.ext4 \
  --size=3G -k ~/.ssh/id_xxx.pub \
  -- \
    --architecture=$ARCH \
    --keyring=/publicly/readable/freexian-archive-key.gpg \
    --include=freexian-archive-keyring \
    --include=linux-image-5.10-XXX \
    http://archive.debian.org/debian/ \
    "deb http://deb.freexian.com/extended-lts $DIST-lts main"
# Note: the initramfs step may take several minutes

Using an ELTS 5.10 kernel backport may be required to boot, typically for stretch/armhf or from an amd64 host. Replace XXX by the kernel for your target architecture (armmp for armhf, arm64 for arm64). 6.1 backports are also available.

See ../technical-workflows.html#debvm for further useful configuration.

Further customization possible, see man debvm-create.

Now run the VM:

debvm-run -i $DIST-$ARCH.ext4 --sshport 2222 -- -m 2G
ssh -p 2222 -o StrictHostKeyChecking=no root@localhost

Limitations:

  • The VM is not hardware-accelerated and quite slow on amd64 (CPU and I/O, 10-20x slower). This increases timeout-related issues. Using eatmydata helps a little, same for mount -t tmpfs none /mnt/workdir -o size=2G, but the main bottleneck appears to be the CPU more than the disk.

  • The VM does not behave exactly like the real buildd hardware, different errors may occur.

Troubleshooting

  • passwd: Cannot determine your user name. (bookworm/0.2.10)

Apply https://salsa.debian.org/helmutg/debvm/-/commit/e4ecc7f745c54a765eff8eff59fc2e9a03371f2e

  • init fails to mount disk, /dev/vda not present; or boot just stalls

Upgrade to a kernel backport: --include=linux-image-5.10-armmp (armhf) or --include=linux-image-5.10-arm64.

Other resources

Pre-built images, with external kernel and initrd:

Manual install from ISO: