I'm really struggling to understand what's to blame with chroot / qemu not work on Ubuntu 18.04. Later editions work (definitely by 19.10) but under 18.04 I get:

cannot run command '/bin/sh' No such file or directory.

I can't work out what's actually broken. I can invoke the armhf binaries without trying to chroot and everything works fine. I can download an x86_64 equivalent for the same environment and chroot into it. But I can't chroot into an armhf environment.

My first guess is that this is something changed with qemu. Ubuntu 18.04 has qemu 2.11 where as Ubuntu 19.10 has qemu 4.0. But I see nothing about chroot mentioned in the qemu change log.

I really want to be able to fix this without fully upgrading the box to a non-LTS release. If I can patch just one thing (even "just" the kernel) then I'm comfortable doing this; but without knowing what's actually broken I'm just stumbling round in the dark.

To reproduce the error:

  • install qemu-user-static on an x86_64 Ubuntu 18.04 machine.
    sudo apt-get install qemu-user-static
  • download an arm chroot environment (eg: alpine mini root file system armhf)
    wget http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/armhf/alpine-minirootfs-3.11.3-armhf.tar.gz
  • extract and chroot into the environment
    mkdir my_env
    cd my_env
    tar -xf ../alpine-minirootfs-3.11.3-armhf.tar.gz
    chroot . /bin/sh

You have missed one step - you need to copy qemu-arm-static executable to the ARMhf filesystem.

So the steps below should work:

wget http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/armhf/alpine-minirootfs-3.11.3-armhf.tar.gz
mkdir my_env
cd my_env
tar -xf ../alpine-minirootfs-3.11.3-armhf.tar.gz
sudo cp /usr/bin/qemu-arm-static ./usr/bin/ # this is essential step!
sudo chroot . /bin/sh

And you will be able to run commands inside this chroot, for example:

# arch


  1. I have tested this method on my Ubuntu 16.04 LTS and 18.04 LTS. It is based on my other answer.
  2. Just tested chroot'ing from upcoming 20.04 LTS - is does not need copying of qemu-arm-static.
| improve this answer | |
  • Thanks for the info. Yes I found the work around earlier today. To be clear though... This doesn't appear to be necessary in later versions of Ubuntu. I'm now thinking this is a change in the kernel but I don't see any mention of it in kernel change logs. – Philip Couling Jan 20 at 18:39
  • Other possibility is to have binfmt-support package installed. When testing this first time I have used wiki.debian.org/RaspberryPi/… as a reference. – N0rbert Jan 20 at 18:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.