【问题标题】:qemu uncaught target signal 11 segmentation fault -- only on arm64 buildqemu 未捕获的目标信号 11 分段错误——仅在 arm64 构建上
【发布时间】:2021-07-24 00:39:38
【问题描述】:

我只是简单地尝试构建 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,一切运行良好。我尝试从运行 arm64 的 Raspberry Pi 构建相同的 Dockerfile,没有任何问题,因此它肯定与 qemu 有关,但不确定是什么。

【问题讨论】:

    标签: docker qemu


    【解决方案1】:

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

    我看到过类似的问题,例如更新的 glibc(可以是任何其他程序甚至客户内核)来使用更新的指令,从而触发仿真中存在的问题。

    我不确定,但这让我想到内核可能是相关的。 嗯,这不是系统虚拟化,它是一个仿真,所以 机会比平时低得多,但可能值得一试。

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

    您尝试了哪些内核?

    【讨论】:

    • 感谢@elboulangero 的详细信息,我遇到了类似的问题,将使用最新的内核进行检查。
    猜你喜欢
    • 2019-07-11
    • 1970-01-01
    • 2020-05-16
    • 2023-01-30
    • 1970-01-01
    • 2022-07-08
    • 2023-01-31
    • 1970-01-01
    • 2015-08-10
    相关资源
    最近更新 更多