4

What I did

Install qemu, qemu-arch-extra, qemu-user-static (AUR) in ArchLinux X86_64. systemd takes care of the binfmt, verified from /proc/sys/fs/binfmt_misc/. Download ArchLinux ARM tarball from its website. The direct link is this http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz. Extract it in a folder with sudo bsdtar -xpf command. Copy the /usr/bin/qemu-aarch64-static file into that folder. Chroot with arch-chroot.

In commandline:

sudo pacman -S qemu qemu-arch-extra
sudo yay -S qemu-user-static
sudo bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C folder
ls /proc/sys/fs/binfmt_misc/
sudo cp /usr/bin/qemu-aarch64-static folder/usr/bin
sudo arch-chroot folder

Result

In the chrooted environment, I can ping any IP address but can not ping any remote host (e.g. example.com) i.e. name resolution does not work. /etc/resolv.conf file is populated. ip shows correct configs of NICs. So, how can I enable name resolution in chrooted ArchLinux ARM? I have tried the same procedure in Ubuntu X86_64 with chrooted into Ubuntu AARCH64. It works.

Biswapriyo
  • 718
  • 2
  • 6
  • 20

1 Answers1

2
  • Firstly, you don't need to copy qemu-aarch64-static into folder

  • Secondly, it seems your /proc/sys/fs/binfmt_misc/ is empty. It needs to be populated with the needed binary.

    To fix that, you can use the binfmt-qemu-static package from AUR that will take care of that for you.

    And finally, you need either to reboot, or restart systemd-binfmt

With this setup, this works very fine for me, and I don't have to do anything to get name resolution in the chroot.

Instead of arch-chroot, one can use also:

systemd-nspawn --bind-ro=/etc/resolv.conf -D folder -M myFancyMachineName

The trick here is not to use --resolv-conf switch (neither of them worked for me) but use a specific bind option.

solsTiCe
  • 824
  • 6
  • 18
  • 1
    Copying `qemu-aarch64-static` into `folder` **was previously** required. The feature which allowed it not to be was introduced in Kernel 4.8 and I've had trouble getting it to work with Ubuntu 18.04 / Kernel 4.15. The OP hasn't listed versions so I would be cautious about suggesting it's not required. – Philip Couling Jan 24 '20 at 13:09
  • @PhilipCouling Ok. I have never done that before. I didn't know about it. – solsTiCe Jan 24 '20 at 17:48
  • I've tried with systemd-nspawn but same error. Name resolution works in armv7, armv5 chrooted env. Also binfmt_misc are already registered from qemu-arm-static package. Maybe there is an issue in my system. I'll check it out. – Biswapriyo Jan 26 '20 at 09:17