Can I run a container for a different CPU architecture using
systemd-nspawn?  I can easily install on my amd64 host a Debian
container of the same architecture and run that:

  # debootstrap stable deb12-amd64
  # systemd-nspawn -D deb12-amd64

and get a shell running in that container.  I can also install a
Debian system of a different architecture and run binaries from it
like this (using qemu-user-binfmt):

  # debootstrap --arch=arm64 --foreign stable deb-arm64
  # QEMU_LD_PREFIX=/usr/aarch64-linux-gnu deb-arm64/bin/date
  Wed Aug 21 16:43:40 CEST 2024

But the following doesn't work

  # QEMU_LD_PREFIX=/usr/aarch64-linux-gnu systemd-nspawn -D deb-arm64
  Spawning container deb-arm64 on /usr/local/deb-arm64.
  Press ^] three times within 1s to kill container.
  execv(/bin/bash, /bin/bash, /bin/sh) failed: No such file or directory
  Container deb-arm64 failed with error code 1.

I'd like to know if it's also possible to run the whole container in
arm64 architecture using systemd-nspawn like above for amd64.

Steve

Reply via email to