Unable to chroot in Tegra Root FileSystem

I’ve downloaded and unpacked Tegra Root FileSystem 24.2 in directory /srv/chroot/Tegra-24.2-arm64. When I try to chroot into it, chroot returns an error: “failed to run command ‘/bin/bash’: No such file or directory”. The file is there, though: ls /srv/chroot/Tegra-24.2-arm64/bin/ls is successful.

# chroot /srv/chroot/TegraRoot-24.2-arm64/
chroot: failed to run command ‘/bin/bash’: No such file or directory
# ls -l /srv/chroot/TegraRoot-24.2-arm64/bin/bash 
-rwxr-xr-x 1 root root 925752 Sep  1  2015 /srv/chroot/TegraRoot-24.2-arm64/bin/bash

Note first that I have another arm64 root filesystem, created with qemu-debootstrap. It’s currently working on the same system. So that means that all qemu emulation stuff is correctly setup.

# chroot /srv/chroot/debian-arm64/ uname -a
Linux linuxbox 4.3.0-0.bpo.1-amd64 #1 SMP Debian 4.3.3-2~bpo8+1 (2015-12-23) aarch64 GNU/Linux

From the information I’ve gathered on the net, this should be due to the ld stuff not working properly. Which seems to be right, as I got the following (less obscure) error whenever I try to run directly the arm64 binaries.

# /srv/chroot/TegraRoot-24.2-arm64/bin/uname -a
/lib/ld-linux-aarch64.so.1: No such file or directory

Therefore, I copied all the chroot fs /lib/aarch64-linux-gnu directory to the actual root, along with the correct symbolic link. Now I’m able to run the arm64 binary, and it reports the correct information. I can event run the arm64 /bin/bash program!

# cp -a /srv/chroot/TegraRoot-24.2-arm64/lib/aarch64-linux-gnu /lib/
# ln -s /lib/aarch64-linux-gnu/ld-2.23.so /lib/ld-linux-aarch64.so.1
# /srv/chroot/TegraRoot-24.2-arm64/bin/uname -a
Linux gvabob03 4.3.0-0.bpo.1-amd64 #1 SMP Debian 4.3.3-2~bpo8+1 (2015-12-23) aarch64 aarch64 aarch64 GNU/Linux
# /srv/chroot/TegraRoot-24.2-arm64/bin/bash
# exit
exit
# chroot /srv/chroot/TegraRoot-24.2-arm64
chroot: failed to run command ‘/bin/bash’: No such file or directory

How can I chroot into Tegra Root FileSystem?

It sounds like you are trying to execute the aarch64 sysroot on your amd64 computer.

Inside aarch64 rootfs, you find aarch64 executables that your amd64 computer is not able to run. In order to do this, you need an emulator like qemu.

Before being able to chroot, the first time it is necessary to install the emulator in the system and in the sysroot:

apt install qemu-user-static
cp /usr/bin/qemu-aarch64-static sysroot/usr/bin

After this you can chroot to sysroot.

I know this post is quite old, but I found it during my searches and I thought to reply may be useful to other users.