Qemu Chroot Into a Different Architecture
Preamble
Directions on using the qemu-user-static package to chroot into a system using emulation. This uses the qemu binaries on the host system to emulate the chroot system.
Setting up the chroot
Preparing the chroot environment
Mount the system you're going to chroot into.
mount /dev/sdb2 /mnt
mount /dev/sdb1 /mnt/boot
Package Installation
Install the following packages on the host
- The emulation binaries will be placed in /usr/bin/qemu-*-static. These are standalone emulation applications and don't require dependencies in chroot.
- The arch-install-scripts provide the "arch-chroot" wrapper script.
apt install qemu-user-static arch-install-scripts
Copying the binaries to the chroot $PATH
The chroot system must have the emulation binary in its own path. Place the
qemu-arm-static
binary in the /usr/bin/
folder.
cp /usr/bin/qemu-arm-static /mnt/usr/bin
Chroot into the system
This was tested on Raspbian ARM for the Raspberry Pi
arch-chroot /mnt qemu-arm-static /bin/bash