Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

armv7 simple-hello fails with chroot: can't execute '/bin/busybox': Exec format error #127

Open
benmoss opened this issue Sep 28, 2022 · 4 comments

Comments

@benmoss
Copy link

benmoss commented Sep 28, 2022

Running from https://github.com/chainguard-dev/melange/tree/9e7b082649e3e36b81dfb84514c733e89ae8b494/examples/simple-hello

docker run --privileged --rm -v "${PWD}":/work   cgr.dev/chainguard/melange build melange.yaml   --arch armv7   --signing-key melange.rsa
2022/09/28 14:13:02 building for [arm/v7]
2022/09/28 14:13:02 melange (hello/armv7): melange is building:
2022/09/28 14:13:02 melange (hello/armv7):   configuration file: melange.yaml
2022/09/28 14:13:02 melange (hello/armv7):   workspace dir: /tmp/melange-workspace-2193273048
2022/09/28 14:13:02 melange (hello/armv7): evaluating pipelines for package requirements
2022/09/28 14:13:02 melange (hello/armv7):   adding package "make" for pipeline "Run autoconf make"
2022/09/28 14:13:02 melange (hello/armv7):   adding package "make" for pipeline "Run autoconf make install"
2022/09/28 14:13:02 melange (hello/armv7):   adding package "binutils" for pipeline "Strip binaries"
2022/09/28 14:13:02 melange (hello/armv7):   adding package "scanelf" for pipeline "Strip binaries"
2022/09/28 14:13:02 melange (hello/armv7): building workspace in '/tmp/melange-guest-3090450258' with apko
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0mbuild context:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  working directory: /tmp/melange-guest-3090450258
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  tarball path: 
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  use proot: false
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  source date: 0001-01-01 00:00:00 +0000 UTC
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  Docker mediatypes: false
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  SBOM output path: 
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  arch: armv7
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0mimage configuration:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  contents:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    repositories: [https://dl-cdn.alpinelinux.org/alpine/edge/main]
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    keyring:      []
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    packages:     [alpine-baselayout-data binutils build-base busybox ca-certificates-bundle make scanelf ssl_client]
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m  accounts:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    runas:  
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    users:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m      - uid=1000(build) gid=1000
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m    groups:
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0m      - gid=1000(build) members=[build]
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0mdoing pre-flight checks
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0mbuilding image fileystem in /tmp/melange-guest-3090450258
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] �[0minitializing apk database
Sep 28 14:13:02.480�[36m [INFO] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0mrunning: /sbin/apk add --initdb --arch armv7 --root /tmp/melange-guest-3090450258
Sep 28 14:13:02.483�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0mOK: 0 MiB in 0 packages
Sep 28 14:13:02.484�[36m [INFO] [arch:armv7] �[0minitializing apk world
Sep 28 14:13:02.484�[36m [INFO] [arch:armv7] �[0minitializing apk keyring
Sep 28 14:13:02.484�[37m [DEBUG] [arch:armv7] �[0minstalling key /usr/share/apk/keys/armv7/[email protected]
Sep 28 14:13:02.484�[36m [INFO] [arch:armv7] �[0minitializing apk repositories
Sep 28 14:13:02.484�[37m [DEBUG] [arch:armv7] �[0minstalling key /usr/share/apk/keys/armv7/[email protected]
Sep 28 14:13:02.484�[36m [INFO] [arch:armv7] �[0msynchronizing with desired apk world
Sep 28 14:13:02.484�[36m [INFO] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0mrunning: /sbin/apk fix --root /tmp/melange-guest-3090450258 --no-scripts --no-cache --update-cache --arch armv7
Sep 28 14:13:02.487�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0mfetch https://dl-cdn.alpinelinux.org/alpine/edge/main/armv7/APKINDEX.tar.gz
Sep 28 14:13:02.947�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(1/29) Installing alpine-baselayout-data (3.3.0-r2)
Sep 28 14:13:02.981�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(2/29) Installing musl (1.2.3-r1)
Sep 28 14:13:03.045�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(3/29) Installing libgcc (12.1.1_git20220630-r6)
Sep 28 14:13:03.066�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(4/29) Installing libstdc++ (12.1.1_git20220630-r6)
Sep 28 14:13:03.191�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(5/29) Installing zlib (1.2.12-r3)
Sep 28 14:13:03.218�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(6/29) Installing binutils (2.39-r2)
Sep 28 14:13:03.455�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(7/29) Installing libmagic (5.42-r0)
Sep 28 14:13:03.519�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(8/29) Installing file (5.42-r0)
Sep 28 14:13:03.543�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(9/29) Installing libgomp (12.1.1_git20220630-r6)
Sep 28 14:13:03.576�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(10/29) Installing libatomic (12.1.1_git20220630-r6)
Sep 28 14:13:03.599�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(11/29) Installing gmp (6.2.1-r2)
Sep 28 14:13:03.660�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(12/29) Installing isl25 (0.25-r0)
Sep 28 14:13:03.805�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(13/29) Installing mpfr4 (4.1.0-r0)
Sep 28 14:13:03.855�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(14/29) Installing mpc1 (1.2.1-r1)
Sep 28 14:13:03.881�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(15/29) Installing gcc (12.1.1_git20220630-r6)
Sep 28 14:13:07.321�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(16/29) Installing libstdc++-dev (12.1.1_git20220630-r6)
Sep 28 14:13:08.662�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(17/29) Installing musl-dev (1.2.3-r1)
Sep 28 14:13:08.892�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(18/29) Installing libc-dev (0.7.2-r3)
Sep 28 14:13:08.910�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(19/29) Installing g++ (12.1.1_git20220630-r6)
Sep 28 14:13:09.988�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(20/29) Installing make (4.3-r0)
Sep 28 14:13:10.039�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(21/29) Installing fortify-headers (1.1-r1)
Sep 28 14:13:10.069�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(22/29) Installing patch (2.7.6-r7)
Sep 28 14:13:10.105�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(23/29) Installing build-base (0.5-r3)
Sep 28 14:13:10.135�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(24/29) Installing busybox (1.35.0-r25)
Sep 28 14:13:10.218�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(25/29) Installing ca-certificates-bundle (20220614-r2)
Sep 28 14:13:10.265�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(26/29) Installing scanelf (1.3.5-r1)
Sep 28 14:13:10.296�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(27/29) Installing libcrypto3 (3.0.5-r2)
Sep 28 14:13:10.471�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(28/29) Installing libssl3 (3.0.5-r2)
Sep 28 14:13:10.517�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0m(29/29) Installing ssl_client (1.35.0-r25)
Sep 28 14:13:10.538�[37m [DEBUG] [arch:armv7] [cmd:apk] [use-proot:false] [use-qemu:] �[0mOK: 164 MiB in 29 packages
Sep 28 14:13:10.548�[36m [INFO] [arch:armv7] �[0mcreating user 1000(build)
Sep 28 14:13:10.549�[36m [INFO] [arch:armv7] �[0mcreating group 1000(build)
Sep 28 14:13:10.550�[36m [INFO] [arch:armv7] [cmd:/bin/busybox] [use-proot:false] [use-qemu:] �[0mrunning: /usr/sbin/chroot /tmp/melange-guest-3090450258 /bin/busybox --install -s
Sep 28 14:13:10.554�[37m [DEBUG] [arch:armv7] [cmd:/bin/busybox] [use-proot:false] [use-qemu:] �[0mchroot: can't execute '/bin/busybox': Exec format error
2022/09/28 14:13:10 ERROR: failed to build package. the build environment has been preserved:
2022/09/28 14:13:10 melange (hello/armv7):   workspace dir: /tmp/melange-workspace-2193273048
2022/09/28 14:13:10 melange (hello/armv7):   guest dir: /tmp/melange-guest-3090450258
Error: failed to build package: unable to build workspace: unable to generate image: failed to install busybox symlinks: failed to install busybox symlinks: exit status 126
2022/09/28 14:13:10 error during command execution: failed to build package: unable to build workspace: unable to generate image: failed to install busybox symlinks: failed to install busybox symlinks: exit status 126
@benmoss
Copy link
Author

benmoss commented Sep 28, 2022

Guessing this is me missing qemu emulation packages?

@amouat
Copy link
Contributor

amouat commented Oct 17, 2022

@benmoss
Copy link
Author

benmoss commented Oct 17, 2022

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Unable to find image 'multiarch/qemu-user-static:latest' locally
latest: Pulling from multiarch/qemu-user-static
f5b7ce95afea: Pull complete
22ee763f0af7: Pull complete
30abb83a18eb: Pull complete
0657daef200b: Pull complete
998118dcc3de: Pull complete
Digest: sha256:16abbe859db6a7d142d90125f3260008f698a224ccd0e776d554cfc46fd025b6
Status: Downloaded newer image for multiarch/qemu-user-static:latest
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Error while loading /qemu-binfmt-conf.sh: Exec format error

Looks like that image only comes in amd64 :/

@benmoss
Copy link
Author

benmoss commented Oct 17, 2022

Seems to work in an amd64 environment though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants