Qemu-user-static not working (4.11)

Host is Ubuntu 20.10 amd64, the container is Ubuntu 18.04 amd64. lxd is 4.11 (latest stable)

I have a Qualcomm BSP that requires Ubuntu 18.04 building host and uses qemu-user-static to chroot on a Ubuntu arm64 version to modify that image. But chroot failed with /usr/sbin/chroot: failed to run command ‘/bin/bash’: Exec format error

First i tried to enable container privilege, without success. And later I found it is block by apparmor. However after I disable apparmor, lxd fails to run since it’s not confined.

Do guys have any suggestions except that reinstalling the system to Ubuntu 18.04?

binfmt is currently a global mechanism.

So to make it work, you’ll need to install qemu-user-static on the host AND in the container so that it gets configured properly.

Thanks, I did install qemu-user-static on the host later, but since binfmt-support.service and update-binfmts still give me incorrect information so I didn’t know it actually works.