Failed to run aarch64 / x86_64 containers on VF2

After setting up qemu and podman, I tried to run cross-architecture containers using --arch, but I got errors:

user@starfive:~$ podman run --arch arm64 '' arch
qemu: uncaught target signal 11 (Segmentation fault) - core dumped

What could be the problem?

I did try to run an aarch64 VM using qemu-system-aarch64 and it worked fine.

we need binfmt_misc support compiled in the kernel and the kernel I have does not have this enabled. Not sure about the latest debian release but the first kernel did not include this feature.

This is a kernel feature that pipes binaries for other cpu architectures through qemu in the background.
See How to recompile kernel to enable BINFMT_MISC support? for rough notes but I have not tested this myself.
Once you have a new kernel you also need to install binfmt-support from apt or run a docker container that contains these binaries like this Docker container.

This seems to be the same problem when I tried to run arm64 chroot with qemu. See Qemu-aarch64-static + chroot = uncaught target signal 11 (Segmentation fault)

It looks like QEMU issue to me, but I was hoping this is a known issue and someone can shed more light.

In my chroot case, the kernel is already patched with binfmt_misc support. So that is not the issue here.

Following @dns ’s suggestion (thanks a lot !) , I successfully got container to run, by installing qemu using the following command:

docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all

Note that qemu above v6.1.0 has hang issue, for unknown reason. @diamond_wolf hope this helps.