Create an arm* VM

Create a jessie/stretch/buster-elts armhf VM, to run and debug a failing package build (or testsuite):

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

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

DIST=buster
ARCH=armhf
debvm-create -r $DIST -o $DIST-$ARCH.debvm -k ~/.ssh/id_xxx.pub \
  --size=2G -- \
    --architecture=$ARCH \
    --keyring=/publicly/readable/freexian-archive-extended-lts.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

Replace XXX by the kernel for your target architecture (armmp for armhf). Using an ELTS kernel backport is required to detect /dev/vda / virtio_blk for jessie and stretch.

Optionally install additional packages:

--include=strace,vim,emacs-nox,... \

For apt-cacher, provide an URL accessible from the host and the VM:

--aptopt='Acquire::http { Proxy "http://192.168.122.1:3142"; }' \

You can add the ELTS staging repo:

"deb http://deb.freexian.com/extended-lts-staging $DIST-lts-proposed main" \

The part after -- is passed to mmdebstrap.

Further customization possible, see man debvm-create.

Now run the VM:

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

The part after -- is passed to qemu.

Limitations:

  • The VM is not hardware-accelerated and quite slow (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

  • E: unable to pick chroot mode automatically (use –mode for manual selection)

Add e.g. --mode=unshare at the end of the debvm-create line, or run through sudo.

  • The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY A07310D369055D5A

Ensure freexian.gpg is readable by any user on your system (e.g. not in your home dir).

Also check the output of gpg:

$ gpg --list-key --no-default-keyring --keyring $PWD/freexian-archive-extended-lts.gpg
/.../freexian-archive-extended-lts.gpg
-------------------------------------------------------
pub   rsa4096 2018-05-28 [SC] [expires: 2027-12-05]
      AB597C4F6F3380BD4B2BEBC2A07310D369055D5A
uid           [ unknown] Extended LTS Repository <sysadmin@freexian.com>
  • passwd: Cannot determine your user name.

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

  • init fails to mount disk, /dev/vda not present (jessie, stretch)

Use a kernel backport: --include=linux-image-5.10-armmp (armhf) or --include=linux-image-5.10-arm64. 6.1 backports are also available for stretch and buster.

Other resources

Pre-built images, with external kernel and initrd:

Manual install from ISO: