Qemu-aarch64-static + chroot = uncaught target signal 11 (Segmentation fault)

Have anybody had any luck in trying out qemu+chroot on any RV boards? I got the following error when running on VisionFive2. The root fs setup should be correct as it runs well on x86 PC.

root@starfive:/home/jsun# update-binfmts --enable qemu-aarch64
root@starfive:/home/jsun# ./hello.aarch64 
hello, world!
root@starfive:/home/jsun# chroot arm64-root/
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault

Try explicitly specifying the binary to run under the chroot (I assume /bin/bash).

Try running it w/o the chroot.

Try running it manually with qemu-aarch64 if even that fails.

I don’t know to how to set up the run-time shared library with manual invocation. It has the following errors.

qemu-aarch64-static: Could not open ‘/lib/ld-linux-aarch64.so.1’: No such file or directory

Any ideas?

I got the same error when trying to run another x86_64 binary in VF2 with qemu-x86_64. I did not try chroot though.

I resolved the issue by downloading the latest qemu-8.0.0 source codes and building it myself for VF2:

build deps:
sudo apt install -y libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libgtk-3-dev

then:

cd qemu-8.0.0
./configure --static --disable-system --enable-linux-user
make -j4
sudo make install
3 Likes

Thanks for the info. It worked for me as well, including entering the chroot environment.

Below is my complete build command on RISC-V.

sudo apt install -y libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libgtk-3-dev
sudo apt install -y ninja-build

wget https://download.qemu.org/qemu-8.0.0.tar.xz

tar xf qemu-8.0.0.tar.xz

cd qemu-8.0.0

./configure --static --disable-system --enable-linux-user --disable-kvm --target-list="aarch64-linux-user"

make -j 4

sudo cp ./build/qemu-aarch64 /usr/local/bin/

2 Likes