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.

8
  • 1
    What is the content of /etc/resolv.conf? Commented Nov 27, 2019 at 15:49
  • The content is nameserver 1.1.1.1, same for x86_64 and aarch64, not symlinked, actual file 0644.
    – Biswapriyo
    Commented Nov 27, 2019 at 15:51
  • What if you add other known servers? for example: nameserver 8.8.8.8 and nameserver 8.8.4.4 (Google DNS server) Commented Nov 27, 2019 at 15:53
  • Same error. As I said that name server work in host OS ArchLinux X86_64.
    – Biswapriyo
    Commented Nov 27, 2019 at 16:05
  • What is the output of ping example.com? What is the output of getent ahosts example.com? What is the output of dig example.com?
    – ctx
    Commented Nov 27, 2019 at 17:45

1 Answer 1

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.

3
  • 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. Commented Jan 24, 2020 at 13:09
  • @PhilipCouling Ok. I have never done that before. I didn't know about it.
    – solsTiCe
    Commented Jan 24, 2020 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
    Commented Jan 26, 2020 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .