Control: tag -1 + moreinfo

On Fri, 15 Mar 2019 15:52:44 +0000 Alex Bennée <alex.ben...@linaro.org> wrote:
Package: qemu-user-static
Version: 1:3.1+dfsg-4
Severity: normal

Dear Maintainer,

Trying to build gitlab-runner on an ThunderX arm64 box it tries to run a
docker image with armhf binaries which fails:

  standard_init_linux.go:207: exec user process caused "exec format error"

You can replicate by running:

  14:30:41 [root@qemu-test:/v/l/d/info] 1 # uname -a
  Linux qemu-test 4.20.0 #5 SMP Tue Jan 8 10:57:44 UTC 2019 aarch64 aarch64 
aarch64 GNU/Linux
  14:30:46 [root@qemu-test:/v/l/d/info] # arch-test -n armhf
  armhf: not supported on this machine/kernel

The underlying reason is because binfmt_misc isn't set up for armhf
binaries because qemu-user-static.postinst does:

  # find which fmts needs to be filtered out, which is arch-dependent.
  case "$DPKG_MAINTSCRIPT_ARCH" in
...
    arm | armel | armhf | arm64) omit="arm|aarch64" ;;
  esac

Which is certainly not true for all aarch64 CPUs. Some do not support
aarch32. The following change makes it work but requires arch-test as a
dependency:

...
    arm | armel | armhf) omit="arm" ;;
    arm64 )
        if arch-test -n armhf > /dev/null; then
            omit="arm|aarch64"
        else
            omit="aarch64"
        fi
        ;;

This logic is repeated in the prerm script so there is probably some
scope in cleaning up and sharing the logic.

Hi Alex!

This should be a runtime test on the installed system, I guess.
It is more: you might install the system on one hardware but but
later run it on a different hardware.

So this becomes, I guess, a startup script or a service which checks
things at boot and enables/disables this particular format according
to arch-test

How do you think if this is worth the effort to implement?

I understand the basics here (without any knowlege whatsoewer about
various arm hardware), but the solution seem to be a bit difficult.

FWIW, I'm enabling binfmt.d/ support for binfmt-misc format registration
(as an alternative to binfmt-support), - not that it makes it more difficult,
just one more condition to check.

Thank you for the bugreport!

/mjt

Reply via email to