publiclab / pi-builder

Developing a reproducible build script system for making Raspberry Pi .img files
MIT License
22 stars 15 forks source link

chroot: failed to run command '/bin/bash': Exec format error #78

Open shaja-asm opened 2 years ago

shaja-asm commented 2 years ago

when running make sd-image I'm getting this error. Hardware Raspberry Pi 3B+ OS: Raspbian OS 64 bit

piuser@raspberrypi:~/pi-builder $ sudo make sd-image
docker build -t image-builder-rpi .
Sending build context to Docker daemon  799.7kB
Step 1/4 : FROM hypriot/image-builder:latest
 ---> 9738ed9fc79d
Step 2/4 : RUN apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y     binfmt-support     qemu     qemu-user-static     --no-install-recommends &&     rm -rf /var/lib/apt/lists/*
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in a380dcd05866
Ign:1 http://deb.debian.org/debian stretch InRelease
Get:2 http://security.debian.org/debian-security stretch/updates InRelease [59.1 kB]
Get:3 http://deb.debian.org/debian stretch-updates InRelease [93.6 kB]
Get:4 http://deb.debian.org/debian stretch Release [118 kB]
Get:5 http://deb.debian.org/debian stretch Release.gpg [3177 B]
Get:6 http://security.debian.org/debian-security stretch/updates/main amd64 Packages [996 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 Packages [9610 kB]
Fetched 10.9 MB in 57s (188 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  libpipeline1 libxen-4.8 openbios-ppc openbios-sparc openhackware qemu-slof
  qemu-system qemu-system-arm qemu-system-mips qemu-system-misc
  qemu-system-ppc qemu-system-sparc qemu-user qemu-utils
Suggested packages:
  samba vde2 qemu-block-extra sudo
Recommended packages:
  qemu-efi
The following NEW packages will be installed:
  binfmt-support libpipeline1 openbios-ppc openbios-sparc openhackware qemu
  qemu-slof qemu-system qemu-system-arm qemu-system-mips qemu-system-misc
  qemu-system-ppc qemu-system-sparc qemu-user qemu-user-static
The following packages will be upgraded:
  libxen-4.8 qemu-utils
2 upgraded, 15 newly installed, 0 to remove and 133 not upgraded.
Need to get 56.5 MB of archives.
After this operation, 376 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian stretch/main amd64 libpipeline1 amd64 1.4.1-2 [27.6 kB]
Get:2 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system-arm amd64 1:2.8+dfsg-6+deb9u17 [5254 kB]
Get:3 http://deb.debian.org/debian stretch/main amd64 binfmt-support amd64 2.1.6-2 [59.5 kB]
Get:4 http://deb.debian.org/debian stretch/main amd64 libxen-4.8 amd64 4.8.5.final+shim4.10.4-1+deb9u12 [413 kB]
Get:5 http://deb.debian.org/debian stretch/main amd64 openhackware all 0.4.1+git-20140423.c559da7c-4 [64.0 kB]
Get:6 http://deb.debian.org/debian stretch/main amd64 qemu-slof all 20161019+dfsg-1 [170 kB]
Get:7 http://deb.debian.org/debian stretch/main amd64 openbios-ppc all 1.1.git20161120-2 [116 kB]
Get:8 http://deb.debian.org/debian stretch/main amd64 openbios-sparc all 1.1.git20161120-2 [160 kB]
Get:9 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system-mips amd64 1:2.8+dfsg-6+deb9u17 [8988 kB]
Get:10 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system-ppc amd64 1:2.8+dfsg-6+deb9u17 [7036 kB]
Get:11 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system-sparc amd64 1:2.8+dfsg-6+deb9u17 [2560 kB]
Get:12 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system-misc amd64 1:2.8+dfsg-6+deb9u17 [13.5 MB]
Get:13 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-system amd64 1:2.8+dfsg-6+deb9u17 [70.7 kB]
Get:14 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-user amd64 1:2.8+dfsg-6+deb9u17 [7954 kB]
Get:15 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-utils amd64 1:2.8+dfsg-6+deb9u17 [992 kB]
Get:16 http://security.debian.org/debian-security stretch/updates/main amd64 qemu amd64 1:2.8+dfsg-6+deb9u17 [156 kB]
Get:17 http://security.debian.org/debian-security stretch/updates/main amd64 qemu-user-static amd64 1:2.8+dfsg-6+deb9u17 [8991 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 56.5 MB in 20s (2748 kB/s)
Selecting previously unselected package libpipeline1:amd64.
(Reading database ... 25938 files and directories currently installed.)
Preparing to unpack .../00-libpipeline1_1.4.1-2_amd64.deb ...
Unpacking libpipeline1:amd64 (1.4.1-2) ...
Selecting previously unselected package binfmt-support.
Preparing to unpack .../01-binfmt-support_2.1.6-2_amd64.deb ...
Unpacking binfmt-support (2.1.6-2) ...
Preparing to unpack .../02-libxen-4.8_4.8.5.final+shim4.10.4-1+deb9u12_amd64.deb ...
Unpacking libxen-4.8:amd64 (4.8.5.final+shim4.10.4-1+deb9u12) over (4.8.3+xsa262+shim4.10.0+comet3-1+deb9u7) ...
Selecting previously unselected package openhackware.
Preparing to unpack .../03-openhackware_0.4.1+git-20140423.c559da7c-4_all.deb ...
Unpacking openhackware (0.4.1+git-20140423.c559da7c-4) ...
Selecting previously unselected package qemu-system-arm.
Preparing to unpack .../04-qemu-system-arm_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system-arm (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-system-mips.
Preparing to unpack .../05-qemu-system-mips_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system-mips (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-slof.
Preparing to unpack .../06-qemu-slof_20161019+dfsg-1_all.deb ...
Unpacking qemu-slof (20161019+dfsg-1) ...
Selecting previously unselected package openbios-ppc.
Preparing to unpack .../07-openbios-ppc_1.1.git20161120-2_all.deb ...
Unpacking openbios-ppc (1.1.git20161120-2) ...
Selecting previously unselected package qemu-system-ppc.
Preparing to unpack .../08-qemu-system-ppc_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system-ppc (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package openbios-sparc.
Preparing to unpack .../09-openbios-sparc_1.1.git20161120-2_all.deb ...
Unpacking openbios-sparc (1.1.git20161120-2) ...
Selecting previously unselected package qemu-system-sparc.
Preparing to unpack .../10-qemu-system-sparc_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system-sparc (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-system-misc.
Preparing to unpack .../11-qemu-system-misc_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system-misc (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-system.
Preparing to unpack .../12-qemu-system_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-system (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-user.
Preparing to unpack .../13-qemu-user_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-user (1:2.8+dfsg-6+deb9u17) ...
Preparing to unpack .../14-qemu-utils_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-utils (1:2.8+dfsg-6+deb9u17) over (1:2.8+dfsg-6+deb9u4) ...
Selecting previously unselected package qemu.
Preparing to unpack .../15-qemu_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu (1:2.8+dfsg-6+deb9u17) ...
Selecting previously unselected package qemu-user-static.
Preparing to unpack .../16-qemu-user-static_1%3a2.8+dfsg-6+deb9u17_amd64.deb ...
Unpacking qemu-user-static (1:2.8+dfsg-6+deb9u17) ...
Setting up openhackware (0.4.1+git-20140423.c559da7c-4) ...
Setting up qemu-user (1:2.8+dfsg-6+deb9u17) ...
Setting up openbios-sparc (1.1.git20161120-2) ...
Setting up libpipeline1:amd64 (1.4.1-2) ...
Setting up qemu-slof (20161019+dfsg-1) ...
Setting up qemu-utils (1:2.8+dfsg-6+deb9u17) ...
Setting up libxen-4.8:amd64 (4.8.5.final+shim4.10.4-1+deb9u12) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up qemu-system-sparc (1:2.8+dfsg-6+deb9u17) ...
Processing triggers for systemd (232-25+deb9u3) ...
Setting up qemu-user-static (1:2.8+dfsg-6+deb9u17) ...
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
Setting up openbios-ppc (1.1.git20161120-2) ...
Setting up qemu-system-misc (1:2.8+dfsg-6+deb9u17) ...
Setting up qemu-system-arm (1:2.8+dfsg-6+deb9u17) ...
Setting up binfmt-support (2.1.6-2) ...
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
mount: permission denied
update-binfmts: warning: Couldn't mount the binfmt_misc filesystem on /proc/sys/fs/binfmt_misc.
Created symlink /etc/systemd/system/multi-user.target.wants/binfmt-support.service → /lib/systemd/system/binfmt-support.service.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up qemu-system-mips (1:2.8+dfsg-6+deb9u17) ...
Setting up qemu-system-ppc (1:2.8+dfsg-6+deb9u17) ...
Setting up qemu-system (1:2.8+dfsg-6+deb9u17) ...
Setting up qemu (1:2.8+dfsg-6+deb9u17) ...
Processing triggers for systemd (232-25+deb9u3) ...
Removing intermediate container a380dcd05866
 ---> 21f45fab88be
Step 3/4 : COPY builder/ /builder/
 ---> 37992ba51b63
Step 4/4 : CMD /builder/build.sh
 ---> [Warning] The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
 ---> Running in 8bd0dd7fd6d5
Removing intermediate container 8bd0dd7fd6d5
 ---> 4edc0a1097dc
Successfully built 4edc0a1097dc
Successfully tagged image-builder-rpi:latest
docker run --rm --privileged -v /home/piuser/pi-builder:/workspace -v /boot:/boot -v /lib/modules:/lib/modules -e CIRCLE_TAG -e VERSION image-builder-rpi
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
+ '[' '!' -f /.dockerenv ']'
+ source /workspace/versions.config
++ HYPRIOT_OS_VERSION=v2.0.1
++ ROOTFS_TAR_CHECKSUM=d1e7e6d48a25b4a206c5df99ecb8815388ec6945e4f97e78413d5a80778d4137
++ RAW_IMAGE=rpi-raw.img
++ RAW_IMAGE_VERSION=v0.2.2
++ RAW_IMAGE_CHECKSUM=2fbeb13b7b0f2308dbd0d82780b54c33003ad43d145ff08498b25fb8bbe1c2c6
++ export KERNEL_BUILD=1.20190517-1
++ KERNEL_BUILD=1.20190517-1
++ export DOCKER_CE_CHANNEL=test
++ DOCKER_CE_CHANNEL=test
++ export DOCKER_CE_VERSION=5:19.03.0~2.2.rc2-0~raspbian-stretch
++ DOCKER_CE_VERSION=5:19.03.0~2.2.rc2-0~raspbian-stretch
++ export DOCKER_COMPOSE_VERSION=1.23.2
++ DOCKER_COMPOSE_VERSION=1.23.2
++ export DOCKER_MACHINE_VERSION=0.16.1
++ DOCKER_MACHINE_VERSION=0.16.1
+ BUILD_RESULT_PATH=/workspace
+ BUILD_PATH=/build
+ ROOTFS_TAR=rootfs-armhf-raspbian-v2.0.1.tar.gz
+ ROOTFS_TAR_PATH=/workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz
+ echo CIRCLE_TAG=
CIRCLE_TAG=
+ HYPRIOT_IMAGE_VERSION=dirty
+ HYPRIOT_IMAGE_NAME=hypriotos-rpi-dirty.img
+ export HYPRIOT_IMAGE_VERSION
+ rm -rf /build
+ mkdir /build
+ '[' '!' -f /workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz ']'
+ wget -q -O /workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz https://github.com/hypriot/os-rootfs/releases/download/v2.0.1/rootfs-armhf-raspbian-v2.0.1.tar.gz
+ sha256sum -c -
+ echo 'd1e7e6d48a25b4a206c5df99ecb8815388ec6945e4f97e78413d5a80778d4137 /workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz'
/workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz: OK
+ tar xf /workspace/rootfs-armhf-raspbian-v2.0.1.tar.gz -C /build
+ update-binfmts --enable qemu-arm
+ mkdir -p /build/proc /build/sys /build/dev/pts
+ mount -o bind /dev /build/dev
+ mount -o bind /dev/pts /build/dev/pts
+ mount -t proc none /build/proc
+ mount -t sysfs none /build/sys
+ cp -R /builder/files/boot /builder/files/etc /builder/files/var /build/
+ chroot /build /bin/bash
chroot: failed to run command '/bin/bash': Exec format error
make: *** [Makefile:7: sd-image] Error 126