1 - Install necessary packages:
pacman -S artools-base qemu-user qemu-user-static qemu-user-static-binfmt
2 - Enable binfmt service if necessary and restart it, dinit example:
dinitctl restart binfmt
3 - Extract the archive somewhere e.g. some ARMtix image https://armtixlinux.org/images/.
4 - You need to bind mount the chroot to itself and then chroot:
mount -o bind <path> <path>
artix-chroot <path>
You can use this script that will handle all and you can safely call it more than once:
#!/bin/sh
if ! mountpoint -q "$HOME"/path/armtix; then
mount -o bind "$HOME"/path/armtix "$HOME"/path/armtix
fi
artix-chroot "$HOME"/path/armtix
Troubleshooting
chroot: failed to run command '/bin/bash': Exec format error
The error above means that something is wrong with binfmt.
Check if binfmt_misc is mounted:
ls /proc/sys/fs/binfmt_misc
register status
If it is empty you have to mount it (that should be done already automatically):
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
Then you have to write the content of /usr/lib/binfmt.d/qemu-aarch64-static.conf (for aarch64 architecture) in /proc/sys/fs/binfmt_misc/register:
echo ':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64-static:FP' > /proc/sys/fs/binfmt_misc/register
Useful links:
https://www.kernel.org/doc/html/v5.9/admin-guide/binfmt-misc.html
https://wiki.archlinux.org/title/Binfmt_misc_for_Java
https://forum.artixlinux.org/index.php/topic,6550.0.html