Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu: uncaught target signal 11 (Segmentation fault) - core dumped #1170

Closed
pranjaldoshi96 opened this issue Jun 16, 2022 · 9 comments
Closed

Comments

@pranjaldoshi96
Copy link

This is follow-up of issue #1169
For repro steps follow #1169
Using latest image as mentioned in https://docs.docker.com/buildx/working-with-buildx/ didn't solve the issue.

docker run --privileged --rm tonistiigi/binfmt --install all

When trying to build arm64 image I am getting following Error

#7 96.84 Setting up libgd3:arm64 (2.3.0-2) ...
#7 96.85 Setting up python3-pip (20.3.4-4+deb11u1) ...
#7 99.72 Setting up python3.9-dev (3.9.2-1) ...
#7 99.73 Setting up libc-devtools (2.31-13+deb11u3) ...
#7 99.73 Setting up libpython3-dev:arm64 (3.9.2-3) ...
#7 99.74 Setting up python3-dev (3.9.2-3) ...
#7 99.75 Processing triggers for libc-bin (2.31-13+deb11u3) ...
#7 99.79 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#7 99.87 Segmentation fault (core dumped)
#7 99.88 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
#7 99.97 Segmentation fault (core dumped)
#7 99.97 dpkg: error processing package libc-bin (--configure):
#7 99.97  installed libc-bin package post-installation script subprocess returned error exit status 139
#7 99.99 Errors were encountered while processing:
#7 99.99  libc-bin
#7 100.1 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
dm_test.Dockerfile:9
--------------------
   7 |     # Install packages
   8 |     RUN apt update
   9 | >>> RUN apt-get install -y python3-pip
  10 |     #Python requirements
  11 |
--------------------
error: failed to solve: process "/bin/sh -c apt-get install -y python3-pip" did not complete successfully: exit code: 100
@pranjaldoshi96
Copy link
Author

Closing this as I found the solution. It was not documented so I hope it can be documented.

The issue was with my qemu version. qemu version 7+ are know to be working fine. Oldler version might have some issues while building arm image on and machines.

Steps to install qemu

  1. Install required dependency
    sudo apt update && apt upgrade -y
    sudo apt install make -y
    sudo apt install ninja-build -y
    sudo apt-get install libpixman-1-dev
    
  2. Download and install qemu 7.0 on machine
    wget https://download.qemu.org/qemu-7.0.0.tar.xz
    tar xvJf qemu-7.0.0.tar.xz
    cd qemu-7.0.0
    ./configure
    make
    
  3. Run binfmt container
    docker run --privileged --rm tonistiigi/binfmt --install all
    
    Check if F is present in flags in output of
    $ cat /proc/sys/fs/binfmt_misc/qemu-aarch64
    enabled
    interpreter /usr/bin/qemu-aarch64-static
    flags: OC
    offset 0
    magic 7f454c460201010000000000000000000200b700
    mask ffffffffffffff00fffffffffffffffffeffffff
    
    If flags in not set to OCF run
    docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes
    
  4. After this setup run docker buildx as you usually do.

@Sonorpearl
Copy link

Thank you. :-)

1 similar comment
@zlshi
Copy link

zlshi commented Jul 8, 2022

Thank you. :-)

@crazy-max
Copy link
Member

crazy-max commented Jul 11, 2022

If someone is willing to make some tests with tonistiigi/binfmt#93 (comment), that would be nice. Thanks.

@pranjaldoshi96
Copy link
Author

pranjaldoshi96 commented Jul 11, 2022

@crazy-max Would love to add test. Can you give brief me on how to go about it.

@chrisguida
Copy link

I had this problem too, and OCF was displayed. However, I still had the segfault until I ran the final command, docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes. Then after that the segfault went away.

@Jubei-VA
Copy link

Jubei-VA commented May 28, 2024

Hey, all.
This isn't related directly to buildx, but I'm just letting you know incase you run into the same issue in the future.

I get libc-bin segfaults running ldconfig with symptoms that look very similar.
Happens in docker and natively when my target is chrooting an aarch64 target and attempting to install packages with apt.
It even occurs the latest Qemu(9.0) is built from source.

But I only get this issue when the host is Ubuntu 24.04. This is strange since the docker container that does the actual chroot is running Ubuntu 18.04, 20.04 etc.

However, when the host OS is Ubuntu 20.04 on the same docker container, there are no segfaults.

@Kamatcho13
Copy link

It's says no superuser binary detected !

@NicolasDorier
Copy link

NicolasDorier commented Oct 20, 2024

Praise to the mighty @pranjaldoshi96 for sharing with us!

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes -c yes fixed it for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants