【问题标题】:qemu uncaught target signal 11 when running dpkg --configure libc-bin运行 dpkg --configure libc-bin 时 qemu 未捕获的目标信号 11
【发布时间】:2022-07-08 13:08:50
【问题描述】:

在我的主机 (amd64) 上运行 docker 容器 (arm64v8/aarch64) 并尝试在 debian 容器上安装/配置 libc-bin 时,出现以下错误:

[ cut for size, full log at https://pastebin.com/7ZtvqZsD ]
#6 18.65 Setting up libc-bin (2.31-13+deb11u3) ...
#6 18.92 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#6 19.03 Segmentation fault (core dumped)
#6 19.06 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#6 19.15 Segmentation fault (core dumped)
#6 19.15 dpkg: error processing package libc-bin (--configure):
#6 19.15  installed libc-bin package post-installation script subprocess returned error exit status 139
#6 19.20 Errors were encountered while processing:
#6 19.20  libc-bin
#6 19.31 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
executor failed running [/bin/sh -c apt-get -y reinstall libc-bin]: exit code: 100

最小的可重现示例

FROM arm64v8/debian
RUN apt-get -y update
RUN apt-get -y reinstall libc-bin

版本

$ qemu-system-aarch64 --version # installed via pacman -S qemu-full
QEMU emulator version 7.0.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developer

$ qemu-system-arm --version # installed via pacman -S qemu-full
QEMU emulator version 7.0.0
Copyright (c) 2003-2022 Fabrice Bellard and the QEMU Project developer

$ docker --version
Docker version 20.10.17, build 100c70180f

## Binfmt extensions installed with
docker run --privileged --rm tonistiigi/binfmt --install all &

$ uname -a
Linux <hostname> 5.18.7-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 25 Jun 2022 20:22:03 +0000 x86_64 GNU/Linux

## OS
Arch linux

事先阅读

(又名请不要将我的问题标记为这些问题的重复项,它与它们不同)

qemu: uncaught target signal 11 (Segmentation fault) - core dumped in docker containers
这些答案都不适合我,我在arch linux repos中运行最新的qemu,据我所知arm64v8/debian不是一个已弃用的容器映像,而且我没有使用docker-for-mac .另外,这个问题与相反的方向有关(arm64 上的amd64 容器)。

qemu: uncaught target signal 11 (Segmentation fault)
问题不源于 git,所以这个问题的答案没有帮助。

qemu-arm qemu: uncaught target signal 11 (Segmentation fault) - core dumped
也没有帮助,我尝试过使用 qemu-user-static v7.0.0(已编译和 -bin),它也没有解决我的问题。不确定 TCG 解释器是什么,所以这可能是问题所在,但我对 qemu 不够熟悉,不知道如何“禁用 TCG 解释器”。

qemu uncaught target signal 11 segmentation fault -- only on arm64 build
我的内核是 5.18.7-zen1-1-zen,它比答案建议的 5.10.0-8 更新,并且是撰写本文时 arch linux repos 上最新的可用内核。

qemu: uncaught target signal 11 (Segmentation fault) - core dumped, when trying to return a struct
所有与我没有使用的 C 相关的答案。

目标

我的最终目标是使用multistrap 构建一个根文件系统,最终将其放在arm64 设备上,但这个问题使我无法做任何事情,因为运行dpkg --configure -a 是必须运行的步骤之一一开始。

    标签: docker segmentation-fault debian cross-compiling qemu


    【解决方案1】:

    在将我的头撞在这堵墙上数周后,我找到的解决方案是:

    • 使用本机 docker 容器而不是基于架构的容器
      • 例如FROM debian:11 而不是 FROM arm64v8/debian:11
    • 在 docker 容器内安装 qemu-user-static
      • 例如apt install qemu-user-static
    • 复制qemu-aarch64-static到rootfs
      • 例如cp $(which qemu-aarch64-static) /rootfs_location/usr/bin/qemu-aarch64(注意文件名的变化)
    • Chroot 正常
      • 例如chroot /rootfs_location/

    我不确定确切地为什么会这样,但它可能源于 debian 和为 arch linux 编译的 qemu-user-static 二进制文件(或碰巧使用的任何操作系统)之间的不兼容,但我并不完全确定这一点。

    【讨论】:

      猜你喜欢
      • 2019-07-11
      • 2021-07-24
      • 2020-05-16
      • 1970-01-01
      • 1970-01-01
      • 2023-01-31
      • 2023-01-30
      • 2020-11-30
      • 2018-01-03
      相关资源
      最近更新 更多