chroot to ARM

mkdir /mnt/rpi
mount -o loop xxx.img /mnt/rpi

Next we’ll copy a statically built QEMU binary for ARM to the mounted image. You might need to install QEMU on the host system first. Furthermore, we need to mount or bind the special system directories from the host to the chroot.

apt-get install qemu-user-static
cp /usr/bin/qemu-arm-static /mnt/rpi/usr/bin/

mount -o bind /dev /mnt/rpi/dev
mount -o bind /dev/pts /mnt/rpi/dev/pts
mount -o bind /proc /mnt/rpi/proc
mount -o bind /sys /mnt/rpi/sys

Next comes the magic. This registers the ARM executable format with the QEMU static binary. Thus, the path to qemu-arm-static has to match where it is located on the host and slave systems (as far as I understand).

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/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register

Finally, it’s time for the moment of truth:

chroot /mnt/rpi

uname -a
Linux hrb 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 armv7l GNU/Linux

In some cases, the error “qemu: uncaught target signal 4 (Illegal instruction) – core dumped” occurs. User kinsa notes here that the lines of the file ld.so.preload (i.e. on the slave, /mnt/rpi/etc/ld.so.preload) has to be commented out (with a # in front).

Congratulations, you now have an ARM based chroot. What to do with it? Maybe install a few “missing” packages before copying over to one or more SD cards, set up the users, modify passwords, etc. Or take advantage of the CPU and memory of the host system or compile from source.

apt-get install htop tree ipython ipython3 gnuplot

As a final note, when done, you want to clean up the mount points.

umount /mnt/rpi/dev
umount /mnt/rpi/proc
umount /mnt/rpi/sys
umount /mnt/rpi



The upgrade from Raspbian Wheezy to Raspbian 8 Jessie is a fairly simple procedure. However, a caution must be exercised as there is always a chance to break the entire system. The less packages and services are installed the more likely you will be able successfully upgrade your Raspbian Linux system.

1. Recommendations:

  • Remove unnecessary packages
  • Fully upgrade your current system
  • Make a data backup
  • Although there should not be a problem to perform update via SSH it is recommended to perform upgrade directly using console

2. Upgrade current system

As per the above recommendation we first fully upgrade our current Raspbian Wheezy system:

# apt-get update
# apt-get upgrade
# apt-get dist-upgrade

Continue only if no errors are display by the above command chain.

3. Update apt sources list

# sed -i 's/wheezy/jessie/g' /etc/apt/sources.list

And comment archive repository. The result should look similar to the one below:

deb http://mirrordirector.raspbian.org/raspbian jessie main firmware contrib non-free
#deb http://archive.raspberrypi.org/debian jessie main

4. Upgrade to Raspbian Jessie

Once you start the actual upgrade you will be given a choice to manually restart any currently running services. Manually restart services is recommended as this give you an option to restart services selectively eg. SSH etc. Furthermore, if you are performing the update via SSH and have no physical access to your Raspberry PI make sure not to disable SSH root access.

Disable SSH password authentication for root?      NO

When ready, initiate system upgrade to Raspbian Jessie:

# apt-get update
# apt-get upgrade
# apt-get dist-upgrade