Issue
When running a docker container (arm64v8
/aarch64
) on my host machine (amd64
) and trying to install/configure libc-bin on a debian container, it gives me the following error:
[ 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
Minimal reproducible example
FROM arm64v8/debian
RUN apt-get -y update
RUN apt-get -y reinstall libc-bin
Versions
$ 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
Prior reading
(a.k.a. please don't mark my question as duplicates of these, it is distinct from them)
qemu: uncaught target signal 11 (Segmentation fault) - core dumped in docker containers
None of these answers work for me, I'm running the latest qemu in the arch linux repos, arm64v8/debian
is not a deprecated container image as far as I can tell, and I'm not using docker-for-mac. Plus, this question regards the opposite direction (amd64
containers on arm64
).
qemu: uncaught target signal 11 (Segmentation fault)
Issue doesn't stem from git, so this question's answer isn't helpful.
qemu-arm qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Not helpful either, I've tried using qemu-user-static v7.0.0 (both compiled and -bin) which didn't fix my issue either. Not sure what the TCG interpreter is, so that could possibly be the issue, but I'm not familiar enough with qemu to know how to "disable the TCG interpreter".
qemu uncaught target signal 11 segmentation fault -- only on arm64 build
My kernel is 5.18.7-zen1-1-zen which is newer than the 5.10.0-8 that the answer suggests, and is the latest available on arch linux repos at time of writing.
qemu: uncaught target signal 11 (Segmentation fault) - core dumped, when trying to return a struct
Answers all related to C, which I'm not using.
Goal
My ultimate goal is to build a root filesystem using multistrap
to eventually be put on an arm64 device, but this issue is preventing me from doing pretty much anything, as running dpkg --configure -a
is one of the steps that has to be run from the very start.
Solution
After bashing my head against this wall for weeks, the solution I found was:
- Use a native docker container instead of an architecture-based one
- e.g.
FROM debian:11
instead ofFROM arm64v8/debian:11
- e.g.
- Install
qemu-user-static
inside the docker container- e.g.
apt install qemu-user-static
- e.g.
- Copy
qemu-aarch64-static
to the rootfs- e.g.
cp $(which qemu-aarch64-static) /rootfs_location/usr/bin/qemu-aarch64
(note the filename change as well)
- e.g.
- Chroot normally
- e.g.
chroot /rootfs_location/
- e.g.
I'm not sure exactly why this works, but it likely stems from an incompatibility between debian and the qemu-user-static binaries that were compiled for arch linux (or whatever OSes happen to be used) but i'm not entirely sure of that.
Answered By - typecasto Answer Checked By - Clifford M. (WPSolving Volunteer)