Categories
Development Linux

Why can qemu emulated binaries not invoke other qemu emulated binaries prior to linux kernel 5.3?

Is anyone able to explain the following in terms of known changes to the Linux Kernel

I have a build script which uses a static qemu (qemu-arm version 4.0.0). This works fine on the latest Ubuntu (19.10) which has Linux Kernel 5.3, but it fails on previous versions (19.04 Kernel 5.0, 18.04 Kernel 4.x).

As far as I can tell the failure is when a qemu ARM emulated binary attempts to call another ARM binary. For example:

# Download Alpine Mini Rootfs for armhf (3.10) see https://alpinelinux.org/downloads/
wget http://dl-cdn.alpinelinux.org/alpine/v3.10/releases/armhf/alpine-minirootfs-3.10.3-armhf.tar.gz

# Extract the image
mkdir test_dir
cd test_dir
sudo tar -xf ../alpine-minirootfs-3.10.3-armhf.tar.gz

# copy in qemu
cp ../qemu-arm-static .

# Test - Works on Ubuntu 19.10 but not 19.04
sudo chroot . /qemu-arm-static /bin/sh -c /bin/ls

On systems where it fails the error is:

/bin/sh: /bin/ls: not found

That is, /bin/sh is executing just fine, but when sh comes to load /bin/ls it fails. I have of course checked that sudo chroot . /qemu-arm-static /bin/ls succeeds.


As far as I can tell the only difference between the two environments could be the kernel because the rest of the behaviour should be controlled only by the downloaded alpine binaries and qemu-arm-static which I have copied. That is, aside from the kernel all of the binaries are identical.

Is there a known change in kernels 5.1, 5.2, or 5.3 that would explain this?

Leave a Reply

Your email address will not be published. Required fields are marked *