alpine-chroot-install: Alpine armhf on x86_64 Ubuntu via qemu returns 127

I am not sure if it is supported, but README suggests that the script uses qemu so I tried and ended up getting 4 errors:

# in ubuntu artful x86_64

# download
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.7.0/alpine-chroot-install     && echo '090d323d887ef3a2fd4e752428553f22a52b87bb  alpine-chroot-install' | sha1sum -c
# set permissions
sudo chmod 777 alpine-chroot-install

sudo ./alpine-chroot-install -a armhf -b v3.7 -m http://dl-cdn.alpinelinux.org/alpine

> Installing and enabling binfmt-support on host system...
Reading package lists... Done
Building dependency tree
Reading state information... Done
binfmt-support is already the newest version (2.1.8-1).
0 upgraded, 0 newly installed, 0 to remove and 88 not upgraded.
'/usr/bin/qemu-arm-static' -> 'usr/bin/qemu-arm-static'

> Downloading static apk-tools
2018-04-25 08:15:10 URL:https://github-production-release-asset-2e65be.s3.amazonaws.com/56234603/7fed7126-f51c-11e7-9a23-c622dbccf101?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180425%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180425T051508Z&X-Amz-Expires=300&X-Amz-Signature=4ddefa9f0a0304527d481b59b8791d94b08b9906a6dd1506796810b22db67b06&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dapk-tools-2.8.2-x86_64-linux.tar.gz&response-content-type=application%2Foctet-stream [814198/814198] -> "apk-tools-2.8.2-x86_64-linux.tar.gz" [1]
apk-tools-2.8.2-x86_64-linux.tar.gz: OK

> Downloading APK keys
2018-04-25 08:15:11 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub: OK
2018-04-25 08:15:11 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub: OK
2018-04-25 08:15:11 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-524d27bb.rsa.pub: OK
2018-04-25 08:15:12 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub: OK
2018-04-25 08:15:12 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-58199dcc.rsa.pub: OK
2018-04-25 08:15:12 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-58cbb476.rsa.pub: OK
2018-04-25 08:15:12 URL:https://alpinelinux.org/keys/alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub [451/451] -> "alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub" [1]
alpine-devel@lists.alpinelinux.org-58e4f17d.rsa.pub: OK

> Installing Alpine Linux v3.7 (armhf) into chroot
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/armhf/APKINDEX.tar.gz
(1/16) Installing musl (1.1.18-r3)
(2/16) Installing busybox (1.27.2-r8)
Executing busybox-1.27.2-r8.post-install
ERROR: busybox-1.27.2-r8.post-install: script exited with error 127
(3/16) Installing alpine-baselayout (3.0.5-r2)
Executing alpine-baselayout-3.0.5-r2.pre-install
ERROR: alpine-baselayout-3.0.5-r2.pre-install: script exited with error 127
Executing alpine-baselayout-3.0.5-r2.post-install
ERROR: alpine-baselayout-3.0.5-r2.post-install: script exited with error 127
(4/16) Installing openrc (0.24.1-r4)
Executing openrc-0.24.1-r4.post-install
ERROR: openrc-0.24.1-r4.post-install: script exited with error 127
(5/16) Installing alpine-conf (3.7.0-r1)
(6/16) Installing libressl2.6-libcrypto (2.6.3-r0)
(7/16) Installing libressl2.6-libssl (2.6.3-r0)
(8/16) Installing zlib (1.2.11-r1)
(9/16) Installing apk-tools (2.9.1-r2)
(10/16) Installing busybox-suid (1.27.2-r8)
(11/16) Installing busybox-initscripts (3.1-r2)
Executing busybox-initscripts-3.1-r2.post-install
ERROR: busybox-initscripts-3.1-r2.post-install: script exited with error 127
(12/16) Installing scanelf (1.2.2-r1)
(13/16) Installing musl-utils (1.1.18-r3)
(14/16) Installing libc-utils (0.7.1-r0)
(15/16) Installing alpine-keys (2.1-r1)
(16/16) Installing alpine-base (3.7.0-r0)
Executing busybox-1.27.2-r8.trigger
ERROR: busybox-1.27.2-r8.trigger: script exited with error 127
4 errors; 5 MiB in 16 packages

Can you point me what I am doing wrong and how to fix it?

Cheers!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Other question: Why are you running that script in a docker container in the first place?

Ok, I have figured it out now. The issue is that if we don’t provide BIND_DIR, it binds the root / of host in chroot and overwrite the /etc directory that has apk.

Passing mkdir /dummy and passing -i /dummy fixed the issue.

Here is the full docker and how to run it:

docker run -it --privileged ubuntu:bionic  # bionic will be next LTS in few days (on 4/29)

in docker:

apt update
apt install -y apt-utils wget < /dev/null
wget https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.7.0/alpine-chroot-install     && echo '090d323d887ef3a2fd4e752428553f22a52b87bb  alpine-chroot-install' | sha1sum -c
chmod 777 alpine-chroot-install

# hack
mkdir /dummy

./alpine-chroot-install -a armhf -b v3.7 -m http://dl-cdn.alpinelinux.org/alpine -i /dummy

/alpine/enter-chroot uname -a

Should it be fixed by making BIND_DIR mounting optional (instead of flashing it with root /)?