Qemu Chroot Into a Different Architecture
1 min read
July 22, 2023
111 words
Chrooting into systems with different architectures
Preface
The qemu-user-static package provides several usermode emulation binaries. We can copy these over to our chroot environment to emulate programs from a different architecture.
Dependencies
The emulation binaries will be placed in /usr/bin/qemu-*-static. These are standalone applications don't require dependencies. The arch-install-scripts provide the "arch-chroot" wrapper script. It handles mounting the psuedo filesystems (dev,proc,sys) so we don't have to.
apt install qemu-user-static arch-install-scripts
Chrooting
Here's me chrooting into Raspbian ARM.
# Mounting raspbian paritions
mount /dev/sdb2 /mnt
mount /dev/sdb1 /mnt/boot
# Copying emulation binary to raspbian path
cp /usr/bin/qemu-arm-static /mnt/usr/bin
# Using qemu-arm-static to emulate the bash shell in chroot
arch-chroot /mnt qemu-arm-static /bin/bash