docker - qemu 未捕获的目标信号 11 段错误——仅适用于 arm64 构建

标签 docker qemu

我只是简单地尝试构建 Kali Linux 的 arm64 镜像,但遇到了 qemu 问题。在为 armv7l 构建此图像时,一切似乎都运行良好,但在 arm64 上却没有运气。
我刚安装 qemu-user-static所以它运行的是最新版本。这是我的 Dockerfile看起来像(仅用于测试目的):

FROM kalilinux/kali-rolling

# Set environment variable for non-interactive install
ARG DEBIAN_FRONTEND=noninteractive

# Run basic commands to update the image and install basic stuff.
RUN apt update && \
  apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
这是我的 docker版本:
ubuntu@ip-10-20-38-44:~$ docker -v
Docker version 20.10.6, build 370c289
这是我正在运行以重现此错误的命令:
ubuntu@ip-10-20-38-44:~$ sudo docker buildx build -t [myusername]/test:latest --platform linux/arm64 .
这是我运行上面的命令时得到的错误输出:
[+] Building 39.9s (5/5) FINISHED                                                                                                                                                                                                                                                                                                              
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                                                                      0.0s 
 => => transferring dockerfile: 418B                                                                                                                                                                                                                                                                                                      0.0s 
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                         0.0s 
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                           0.0s 
 => [internal] load metadata for docker.io/kalilinux/kali-rolling:latest                                                                                                                                                                                                                                                                  0.4s 
 => CACHED [1/2] FROM docker.io/kalilinux/kali-rolling@sha256:bd098f211b325a7872c224a7eae755bb38332ea2d375376c75f10c0f194b8d8d                                                                                                                                                                                                            0.0s 
 => => resolve docker.io/kalilinux/kali-rolling@sha256:bd098f211b325a7872c224a7eae755bb38332ea2d375376c75f10c0f194b8d8d                                                                                                                                                                                                                   0.0s 
 => ERROR [2/2] RUN apt update &&   apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"                                                                                                                                                                                                        39.5s 
------                                                                                                                                                                                                                                                                                                                                         
 > [2/2] RUN apt update &&   apt dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold":                                                                                                                                                                                                                    
#5 0.187                                                                                                                                                                                                                                                                                                                                       
#5 0.189 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.                                                                               
#5 0.189                                                                                                                                                               
#5 1.245 Get:1 http://mirrors.ocf.berkeley.edu/kali kali-rolling InRelease [30.5 kB]                                                                                   
#5 3.537 Get:2 http://mirrors.ocf.berkeley.edu/kali kali-rolling/contrib arm64 Packages [87.6 kB]                                                                      
#5 3.732 Get:3 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 Packages [17.5 MB]
#5 13.00 Get:4 http://mirrors.ocf.berkeley.edu/kali kali-rolling/non-free arm64 Packages [157 kB]                                                                      
#5 17.95 Fetched 17.8 MB in 18s (1008 kB/s)                                                                                                                            
#5 17.95 Reading package lists...                                                                                                                                      
#5 24.55 Building dependency tree...                                                                                                                                   
#5 25.32 Reading state information...                                                                                                                                  
#5 25.37 3 packages can be upgraded. Run 'apt list --upgradable' to see them.                                                                                          
#5 25.45                                                                                                                                                               
#5 25.45 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.                                                                               
#5 25.45                                                                                                                                                               
#5 25.54 Reading package lists...                                                                                                                                      
#5 31.98 Building dependency tree...                                                                                                                                   
#5 32.76 Reading state information...                                                                                                                                  
#5 32.84 Calculating upgrade...                                                                                                                                        
#5 34.15 The following packages will be upgraded:                                                                                                                      
#5 34.15   kali-defaults libcrypt1 sysvinit-utils                                                                                                                                                                                                                                                                                              
#5 34.78 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.                                                                                                                                                                                                                                                                        
#5 34.78 Need to get 593 kB of archives.                                           
#5 34.78 After this operation, 1024 B of additional disk space will be used.
#5 34.78 Get:1 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 sysvinit-utils arm64 2.96-7 [25.1 kB]                                                      
#5 34.90 Get:2 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 libcrypt1 arm64 1:4.4.18-2 [89.4 kB]
#5 34.98 Get:3 http://mirrors.ocf.berkeley.edu/kali kali-rolling/main arm64 kali-defaults all 2021.2.3 [479 kB]
#5 36.16 debconf: delaying package configuration, since apt-utils is not installed                                                                                     
#5 36.34 Fetched 593 kB in 1s (536 kB/s)                                                                                                                               
(Reading database ... 6748 files and directories currently installed.)                                                                                                 
#5 36.53 Preparing to unpack .../sysvinit-utils_2.96-7_arm64.deb ...                                                                                                   
#5 36.55 Unpacking sysvinit-utils (2.96-7) over (2.96-6) ...                                                                                                           
#5 36.76 Setting up sysvinit-utils (2.96-7) ...                       
(Reading database ... 6748 files and directories currently installed.)                                                                                                                                                                                                                                                                         
#5 37.00 Preparing to unpack .../libcrypt1_1%3a4.4.18-2_arm64.deb ...                                                                                                                                                                                                                                                                          
#5 37.03 Unpacking libcrypt1:arm64 (1:4.4.18-2) over (1:4.4.17-1) ...
#5 37.23 Setting up libcrypt1:arm64 (1:4.4.18-2) ...                   
(Reading database ... 6748 files and directories currently installed.)                                                                                                 
#5 37.47 Preparing to unpack .../kali-defaults_2021.2.3_all.deb ...  
#5 37.89 Unpacking kali-defaults (2021.2.3) over (2021.2.2) ...
#5 38.28 Setting up kali-defaults (2021.2.3) ...
#5 38.58 Configuring /etc/environment
#5 38.75 Processing triggers for libc-bin (2.31-9) ...
#5 38.81 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 39.02 Segmentation fault (core dumped)
#5 39.04 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#5 39.25 Segmentation fault (core dumped)
#5 39.26 dpkg: error processing package libc-bin (--configure):
#5 39.26  installed libc-bin package post-installation script subprocess returned error exit status 139
#5 39.27 Errors were encountered while processing:
#5 39.27  libc-bin
#5 39.34 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
Dockerfile:7
如果我切换 arm64,一切运行正常至 arm/v7 .我试图从正在运行的 Raspberry Pi 构建相同的 Dockerfile arm64没有问题,所以它肯定与 qemu 有关,但不确定是什么。

最佳答案

似乎与内核中的错误有关。我能找到的最好的解释是在 https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1928075 .在本次讨论中引用 Christian Ehrhardt 的话:

I've seen similar issues due to e.g. a newer glibc (could be any other program or even guest kernel) to use newer instructions and thereby trigger an issue that exists in the emulation.

I'm not sure, but this makes me think of the kernel maybe being related. Well this isn't system-virtualization, it is an emulation so the chances are much lower than usual, but might be worth a try.


我遇到了同样的问题并尝试了很多不同的用户空间组合(即不同版本的 Qemu、不同的 Debian 容器),但无济于事。解决这个问题的唯一方法确实是运行一个足够新的内核。我使用的是 Debian 内核 5.10.0-8-amd64现在,它的工作原理。
您尝试了哪些内核?

关于docker - qemu 未捕获的目标信号 11 段错误——仅适用于 arm64 构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67337798/

相关文章:

windows - 是否可以将 kubernetes 作为 docker 容器运行?

docker - Docker网络功能如何提供服务发现?

Android 模拟器 (qemu) 不允许某些 tcp 连接(RST,ACK 作为对 SYN 的回答)

英特尔 HAXM API 可以在 QEMU 之外使用吗?

docker - 使用VS2017发布到容器注册表,如何设置标签或图像名称?

docker - 无法获取kubelets cgroup

docker - 在 Kubernetes 或 Google Container Engine 中等待作业/pod 完成

c - 使用libvirt API在C程序中获取KVM虚拟机域名

android - Qemu,除以零,mxcsr 寄存器

c++ - 编译qemu-xen时signal.c出错