I have problems with chroot. I have a host machine which is amd64 and I want to work using qemu on aarch64 and I tried using this script:

echo ">>>"
echo ">>> Configuring ARMv7-A environment"
echo ">>>"
echo $PWD
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
echo ">>>  mounting filesystems"
mount -t proc proc $PWD/proc || echo "FAILED /proc"
mount -t sysfs sysfs $PWD/sys || echo "FAILED /sys"
mount --bind /dev $PWD/dev || echo "FAILED /dev"   
mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime shm $PWD/dev/shm || echo "FAILED /dev/shm"

cat /proc/sys/fs/binfmt_misc/status
cat /proc/sys/fs/binfmt_misc/arm   
cp /etc/resolv.conf $PWD/etc/resolv.conf || echo "FAILED resolv.conf"
echo ">>> entering ARMv7-A environment at $PWD"

chroot $PWD bin/bash

echo "<<<"
echo "<<< Back to native environment!"
echo "<<<"
umount $PWD/dev/shm
umount $PWD/dev
umount $PWD/sys    
umount $PWD/proc
echo -1 > /proc/sys/fs/binfmt_misc/arm

However, when running it, I get an exception:

>>> entering ARMv7-A environment at /var/chroot/armv7a
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
../enterarmv7a.sh: line 18: 23146 Segmentation fault      (core dumped) chroot $PWD bin/bash

What could it be? I am using Ubuntu 20.04 and installed qemu using apt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.