Sample Header Ad - 728x90

"cannot execute: required file not found" when chroot to a rootfs with different architecture

2 votes
0 answers
25 views
I bootstrapped an arch x86_64 rootfs on arch linux arm vm with qemu-x86_64 binfmt registered and copied static qemu-x86_64 to the same path in the chroot:
[root@archlinux ~]# cat /proc/sys/fs/binfmt_misc/qemu-x86_64
enabled
interpreter /usr/bin/qemu-x86_64
flags: PF
offset 0
magic 7f454c4602010100000000000000000002003e00

[root@archlinux ~]# file rfs/usr/bin/qemu-x86_64 
rfs/usr/bin/qemu-x86_64: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), static-pie linked, BuildID[sha1]=1640ccd48aea1547a7b9d5a265cd35cfd9367cbd, for GNU/Linux 3.7.0, with debug_info, not stripped
It threw errors like:
:: Running post-transaction hooks...
( 1/11) Creating system user accounts...
call to execv failed (No such file or directory)
error: command failed to execute correctly
I tried to use
rfs qemu-x86_64 /usr/bin/bash
, the shell seems launch correctly, but any command I type did not work:
[root@archlinux ~]# chroot rfs qemu-x86_64 /usr/bin/bash
ls
/usr/bin/bash: line 1: /usr/bin/ls: cannot execute: required file not found
env
/usr/bin/bash: line 2: /usr/bin/env: cannot execute: required file not found
exit
But running command directly works:
[root@archlinux ~]# chroot rfs qemu-x86_64 /usr/bin/ls
bin
boot
dev
etc
home
lib
lib64
mnt
opt
proc
root
run
sbin
srv
sys
tmp
usr
var
Why and how to fix it?
Asked by William (205 rep)
Aug 5, 2025, 03:21 AM
Last activity: Aug 5, 2025, 05:34 AM