首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >由于libc-bin分段错误,无法为arm64构建Dockerfile

由于libc-bin分段错误,无法为arm64构建Dockerfile
EN

Ask Ubuntu用户
提问于 2021-05-20 14:02:20
回答 3查看 3.1K关注 0票数 6

当我试图为linux/arm64平台构建一个Dockerfile时,我得到了以下错误:

代码语言:javascript
运行
复制
#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)

我一直在修改我的Dockerfile,内容如下:

代码语言:javascript
运行
复制
FROM kalilinux/kali-rolling
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
RUN apt update && \
    apt install wget -y

解决尝试#1

想到的第一件事是:https://stackoverflow.com/questions/59139453/repository-is-not-signed-in-docker-build/66215465#66215465。我在ARM 32位处理器上安装东西时遇到了这种情况,所以我尝试将相同的依赖项添加到这个Dockerfile中,但没有成功。这些依赖关系是:

然而,这一问题仍然存在。

解决方案尝试#2

我遇到了https://github.com/docker/for-linux/issues/1131,并试图添加-o APT::Immediate-Configure=0以获得我的apt install命令,但这也不起作用。

解决方案尝试#3

接下来,我遇到了一个答案:https://askubuntu.com/a/1035226/269349。当我修改我的Dockerfile时,如下所示:

代码语言:javascript
运行
复制
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

我开始收到的下一个错误是:

代码语言:javascript
运行
复制
 => 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 |
--------------------

解决方案尝试#4

我在前面的答案(重新安装libc)的下面尝试了这个答案,但随后遇到了这个问题:

代码语言:javascript
运行
复制
#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)

下面是我正在运行的命令:docker buildx build --platform linux/arm64 .

任何帮助都将不胜感激。

EN

回答 3

Ask Ubuntu用户

发布于 2021-08-19 18:46:04

根据这个bug报告,它似乎是内核中的一个bug,应该通过将内核更新到最新版本:https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1928075来解决。

我可以在GitLab CI中重现这个bug,而且似乎只有架构arm64触发了这个bug。armhf很好:https://gitlab.com/arnaudr/test-binfmt-misc/-/pipelines/356065926/builds

票数 0
EN

Ask Ubuntu用户

发布于 2021-10-15 22:54:38

通过移动到最新的qemu 5,我能够在Ubuntu 20.04上解决这个问题

代码语言:javascript
运行
复制
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
EN

Ask Ubuntu用户

发布于 2021-12-13 19:13:24

这个错误发生在我在AMD虚拟机上使用QEMU进行仿真时运行ARM。

下面是一个适用于我的示例命令

代码语言:javascript
运行
复制
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
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1339558

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档