7

I am getting the following error while trying to build a Dockerfile for the linux/arm64 platform:

#5 58.06 Processing triggers for libc-bin (2.31-11) ...
#5 58.12 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 58.33 Segmentation fault (core dumped)
#5 58.35 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 58.69 Segmentation fault (core dumped)
#5 58.70 dpkg: error processing package libc-bin (--configure):
#5 58.70  installed libc-bin package post-installation script subprocess returned error exit status 139
#5 58.70 Processing triggers for ca-certificates (20210119) ...
#5 58.87 Updating certificates in /etc/ssl/certs...
#5 71.86 0 added, 0 removed; done.
#5 71.86 Running hooks in /etc/ca-certificates/update.d...
#5 71.89 done.
#5 71.98 Errors were encountered while processing:
#5 71.98  libc-bin
#5 72.06 E: Sub-process /usr/bin/dpkg returned an error code (1)

I have trimmed my Dockerfile all the way to the below contents:

FROM kalilinux/kali-rolling
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
RUN apt update && \
    apt install wget -y

Solution Attempt #1

The first thing that came to mind was this: https://stackoverflow.com/questions/59139453/repository-is-not-signed-in-docker-build/66215465#66215465. I ran across this while just installing things on an ARM 32-bit processor, and so I tried adding the same dependencies into this Dockerfile, with no success. These dependencies were:

However, the issue still persists.

Solution Attempt #2

I ran across https://github.com/docker/for-linux/issues/1131 and tried appending -o APT::Immediate-Configure=0 to get my apt install command, but that didn't work either.

Solution Attempt #3

Next, I ran across this answer: https://askubuntu.com/a/1035226/269349. When I modified my Dockerfile to look like this:

FROM kalilinux/kali-rolling
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
RUN apt update && \
  rm /var/cache/ldconfig/aux-cache && \
  /sbin/ldconfig && \
  apt install wget -y -o APT::Immediate-Configure=0

the next error I started receiving is this:

 => ERROR [2/2] RUN apt update &&   rm /var/cache/ldconfig/aux-cache &&   /sbin/ldconfig &&   apt install wget -y -o APT::Immediate-Configure=0                                                                                                                                                                                                                       77.8s
------
 > [2/2] RUN apt update &&   rm /var/cache/ldconfig/aux-cache &&   /sbin/ldconfig &&   apt install wget -y -o APT::Immediate-Configure=0:
#5 0.203
#5 0.204 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.205
#5 1.055 Get:1 http://mirrors.jevincanders.net/kali kali-rolling InRelease [30.5 kB]
#5 3.496 Get:2 http://mirrors.jevincanders.net/kali kali-rolling/non-free arm64 Packages [157 kB]
#5 4.211 Get:3 http://mirrors.jevincanders.net/kali kali-rolling/main arm64 Packages [17.5 MB]
#5 67.37 Get:4 http://mirrors.jevincanders.net/kali kali-rolling/contrib arm64 Packages [87.3 kB]
#5 71.57 Fetched 17.8 MB in 1min 11s (249 kB/s)
#5 71.57 Reading package lists...
#5 76.73 Building dependency tree...
#5 77.44 Reading state information...
#5 77.51 4 packages can be upgraded. Run 'apt list --upgradable' to see them.
#5 77.55 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 77.74 Segmentation fault (core dumped)
------
Dockerfile:4
--------------------
   3 |     ARG TARGETPLATFORM
   4 | >>> RUN apt update && \
   5 | >>>   rm /var/cache/ldconfig/aux-cache && \
   6 | >>>   /sbin/ldconfig && \
   7 | >>>   apt install wget -y -o APT::Immediate-Configure=0
   8 |
--------------------

Solution Attempt #4

I tried the answer right below the one from the previous answer (reinstalling libc-bin), but then ran into this issue:

#4 25.05 Get:1 http://mirrors.jevincanders.net/kali kali-rolling/main arm64 libc-bin arm64 2.31-11 [735 kB]
#4 27.93 debconf: delaying package configuration, since apt-utils is not installed
#4 28.12 Fetched 735 kB in 2s (295 kB/s)
(Reading database ... 6748 files and directories currently installed.)
#4 28.30 Preparing to unpack .../libc-bin_2.31-11_arm64.deb ...
#4 28.32 Unpacking libc-bin (2.31-11) over (2.31-11) ...
#4 28.84 Setting up libc-bin (2.31-11) ...
#4 28.98 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#4 29.20 Segmentation fault (core dumped)
#4 29.22 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#4 29.42 Segmentation fault (core dumped)
#4 29.42 dpkg: error processing package libc-bin (--configure):
#4 29.42  installed libc-bin package post-installation script subprocess returned error exit status 139
#4 29.43 Errors were encountered while processing:
#4 29.43  libc-bin
#4 29.51 E: Sub-process /usr/bin/dpkg returned an error code (1)

Here's the command that I'm running: docker buildx build --platform linux/arm64 .

Any help would be greatly appreciated.

4 Answers 4

1

There seems to be some issues between certain combinations of kernel version and qemu version.

More information is available in docker buildx GitHub repo.

There is a comment there that solved my issues, that is:

$ docker pull tonistiigi/binfmt:latest
$ docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-*
$ docker run --privileged --rm tonistiigi/binfmt --install all)

Don't skip the --uninstall step!

This steps solved my issue, which seems to match the one described by the question.

0

According to this bug report, it seems to be a bug in the kernel, and it should be solved by updating the kernel to the latest version: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1928075

I can reproduce this bug in GitLab CI, and it seems that only the architecture arm64 triggers the bug. armhf is just fine: https://gitlab.com/arnaudr/test-binfmt-misc/-/pipelines/356065926/builds

0

I was able to solve this on Ubuntu 20.04 by moving to latest qemu 5 using

sudo add-apt-repository ppa:jacob/virtualisation (for Ubuntu 20.04)
sudo apt-get update && sudo apt-get install qemu qemu-user qemu-user-static
0

This error has happened to me running ARM on emulation using QEMU on an AMD virtual machine.

Here is an example command that works for me:

FROM php:7.4

# See also https://forums.linuxmint.com/viewtopic.php?p=1871690
RUN apt-get update && \
  apt-get install -y libc-bin && \
  apt-get update && \
  apt-get install -y --no-install-recommends mariadb-client git zip || true && \
  dpkg --purge --force-all libc-bin && \
  apt-get install -y --no-install-recommends mariadb-client git zip && \
  rm -rf /var/lib/apt/lists/*
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .