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

Multi arch build is broken when installing libc-bin with apt-get #3036

Open
3 tasks done
galusben opened this issue Mar 3, 2025 · 2 comments
Open
3 tasks done

Multi arch build is broken when installing libc-bin with apt-get #3036

galusben opened this issue Mar 3, 2025 · 2 comments

Comments

@galusben
Copy link

galusben commented Mar 3, 2025

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

With this minimal Dockerfile I see the issue:

FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install libc-bin

And build with:

sudo docker buildx create --use
sudo docker buildx build --platform linux/arm64,linux/amd64   .

I tried on multiple platforms.
Here is one which is very standard and I can provide all the details:

cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Platform:
x86_64 GNU/Linux

Client: Docker Engine - Community
Version: 28.0.1
API version: 1.48
Go version: go1.23.6
Git commit: 068a01e
Built: Wed Feb 26 10:41:12 2025
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 28.0.1
API version: 1.48 (minimum version 1.24)
Go version: go1.23.6
Git commit: bbd0a17
Built: Wed Feb 26 10:41:12 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.25
GitCommit: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
runc:
Version: 1.2.4
GitCommit: v1.2.4-0-g6c52b3f
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Expected behaviour

The build will work.
When I build without emulation it is working.

Actual behaviour

sudo docker buildx build     --platform linux/arm64,linux/amd64   .
[+] Building 28.0s (11/11) FINISHED                                                                                                                                                                                                              docker-container:elastic_ellis
 => [internal] booting buildkit                                                                                                                                                                                                                                            1.1s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                                                                                         0.9s
 => => creating container buildx_buildkit_elastic_ellis0                                                                                                                                                                                                                   0.2s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                       0.0s
 => => transferring dockerfile: 103B                                                                                                                                                                                                                                       0.0s
 => [linux/arm64 internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                1.2s
 => [linux/amd64 internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                1.2s
 => [internal] load .dockerignore                                                                                                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                            0.0s
 => [linux/amd64 1/3] FROM docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                          0.9s
 => => resolve docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                                      0.0s
 => => sha256:9cb31e2e37eab1bff50f727e979fcacb509e225fb853433a6fe21d2fb34e6305 29.54MB / 29.54MB                                                                                                                                                                           0.3s
 => => extracting sha256:9cb31e2e37eab1bff50f727e979fcacb509e225fb853433a6fe21d2fb34e6305                                                                                                                                                                                  0.5s
 => [linux/arm64 1/3] FROM docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                          0.9s
 => => resolve docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                                      0.0s
 => => sha256:0d1c17d4e593cf07e0f9e907017f6edbe7e32dd2b7f8e3f026c74bbaf3466561 27.36MB / 27.36MB                                                                                                                                                                           0.3s
 => => extracting sha256:0d1c17d4e593cf07e0f9e907017f6edbe7e32dd2b7f8e3f026c74bbaf3466561                                                                                                                                                                                  0.5s
 => [linux/amd64 2/3] RUN apt-get update                                                                                                                                                                                                                                   3.4s
 => [linux/arm64 2/3] RUN apt-get update                                                                                                                                                                                                                                  14.5s
 => [linux/amd64 3/3] RUN apt-get install libc-bin                                                                                                                                                                                                                         1.7s
 => ERROR [linux/arm64 3/3] RUN apt-get install libc-bin                                                                                                                                                                                                                  10.2s 
------                                                                                                                                                                                                                                                                          
 > [linux/arm64 3/3] RUN apt-get install libc-bin:                                                                                                                                                                                                                              
0.537 Reading package lists...                                                                                                                                                                                                                                                  
6.222 Building dependency tree...                                                                                                                                                                                                                                               
7.035 Reading state information...                                                                                                                                                                                                                                              
7.837 Suggested packages:                                                                                                                                                                                                                                                       
7.837   manpages                                                                                                                                                                                                                                                                
7.967 The following packages will be upgraded:                                                                                                                                                                                                                                  
7.969   libc-bin                                                                                                                                                                                                                                                                
8.159 1 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.                                                                                                                                                                                                           
8.159 Need to get 600 kB of archives.                                                                                                                                                                                                                                           
8.159 After this operation, 0 B of additional disk space will be used.
8.159 Get:1 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 libc-bin arm64 2.35-0ubuntu3.9 [600 kB]
9.070 debconf: delaying package configuration, since apt-utils is not installed
9.225 Fetched 600 kB in 0s (2421 kB/s)
(Reading database ... 4387 files and directories currently installed.)
9.405 Preparing to unpack .../libc-bin_2.35-0ubuntu3.9_arm64.deb ...
9.417 Unpacking libc-bin (2.35-0ubuntu3.9) over (2.35-0ubuntu3.8) ...
9.663 Setting up libc-bin (2.35-0ubuntu3.9) ...
9.793 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
9.898 Segmentation fault (core dumped)
9.939 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
10.04 Segmentation fault (core dumped)
10.05 dpkg: error processing package libc-bin (--configure):
10.05  installed libc-bin package post-installation script subprocess returned error exit status 139
10.06 Errors were encountered while processing:
10.06  libc-bin
10.13 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:3
--------------------
   1 |     FROM ubuntu:22.04
   2 |     RUN apt-get update
   3 | >>> RUN apt-get install libc-bin
   4 |     
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get install libc-bin" did not complete successfully: exit code: 100

Buildx version

github.com/docker/buildx v0.21.1 7c2359c

Docker info

Client: Docker Engine - Community
 Version:    28.0.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.21.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.33.1
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 2
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 28.0.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
 runc version: v1.2.4-0-g6c52b3f
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-1023-aws
 Operating System: Ubuntu 24.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.34GiB
 Name: ip-10-90-102-194
 ID: 0c443081-ff0e-4275-b0b7-e98e82b409c7
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Builders list

sudo docker buildx ls
NAME/NODE                   DRIVER/ENDPOINT                   STATUS    BUILDKIT   PLATFORMS
confident_goldwasser        docker-container                                       
 \_ confident_goldwasser0    \_ unix:///var/run/docker.sock   running   v0.20.0    linux/amd64 (+4), linux/386
elastic_ellis*              docker-container                                       
 \_ elastic_ellis0           \_ unix:///var/run/docker.sock   running   v0.20.0    linux/amd64 (+4), linux/386
default                     docker                                                 
 \_ default                  \_ default                       running   v0.20.0    linux/amd64 (+4), linux/386

Configuration

FROM ubuntu:22.04
RUN apt-get update
RUN apt-get install libc-bin


sudo docker buildx create --use
sudo docker buildx build --platform linux/arm64,linux/amd64   .

Build logs

galba@ip-10-90-102-194:~/docker-repro$ sudo docker buildx create --use
elastic_ellis
galba@ip-10-90-102-194:~/docker-repro$ sudo docker buildx build     --platform linux/arm64,linux/amd64   .
[+] Building 28.0s (11/11) FINISHED                                                                                                                                                                                                              docker-container:elastic_ellis
 => [internal] booting buildkit                                                                                                                                                                                                                                            1.1s
 => => pulling image moby/buildkit:buildx-stable-1                                                                                                                                                                                                                         0.9s
 => => creating container buildx_buildkit_elastic_ellis0                                                                                                                                                                                                                   0.2s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                       0.0s
 => => transferring dockerfile: 103B                                                                                                                                                                                                                                       0.0s
 => [linux/arm64 internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                1.2s
 => [linux/amd64 internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                                                                                                                1.2s
 => [internal] load .dockerignore                                                                                                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                            0.0s
 => [linux/amd64 1/3] FROM docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                          0.9s
 => => resolve docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                                      0.0s
 => => sha256:9cb31e2e37eab1bff50f727e979fcacb509e225fb853433a6fe21d2fb34e6305 29.54MB / 29.54MB                                                                                                                                                                           0.3s
 => => extracting sha256:9cb31e2e37eab1bff50f727e979fcacb509e225fb853433a6fe21d2fb34e6305                                                                                                                                                                                  0.5s
 => [linux/arm64 1/3] FROM docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                          0.9s
 => => resolve docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                                                                                                                                      0.0s
 => => sha256:0d1c17d4e593cf07e0f9e907017f6edbe7e32dd2b7f8e3f026c74bbaf3466561 27.36MB / 27.36MB                                                                                                                                                                           0.3s
 => => extracting sha256:0d1c17d4e593cf07e0f9e907017f6edbe7e32dd2b7f8e3f026c74bbaf3466561                                                                                                                                                                                  0.5s
 => [linux/amd64 2/3] RUN apt-get update                                                                                                                                                                                                                                   3.4s
 => [linux/arm64 2/3] RUN apt-get update                                                                                                                                                                                                                                  14.5s
 => [linux/amd64 3/3] RUN apt-get install libc-bin                                                                                                                                                                                                                         1.7s
 => ERROR [linux/arm64 3/3] RUN apt-get install libc-bin                                                                                                                                                                                                                  10.2s 
------                                                                                                                                                                                                                                                                          
 > [linux/arm64 3/3] RUN apt-get install libc-bin:                                                                                                                                                                                                                              
0.537 Reading package lists...                                                                                                                                                                                                                                                  
6.222 Building dependency tree...                                                                                                                                                                                                                                               
7.035 Reading state information...                                                                                                                                                                                                                                              
7.837 Suggested packages:                                                                                                                                                                                                                                                       
7.837   manpages                                                                                                                                                                                                                                                                
7.967 The following packages will be upgraded:                                                                                                                                                                                                                                  
7.969   libc-bin                                                                                                                                                                                                                                                                
8.159 1 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.                                                                                                                                                                                                           
8.159 Need to get 600 kB of archives.                                                                                                                                                                                                                                           
8.159 After this operation, 0 B of additional disk space will be used.
8.159 Get:1 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 libc-bin arm64 2.35-0ubuntu3.9 [600 kB]
9.070 debconf: delaying package configuration, since apt-utils is not installed
9.225 Fetched 600 kB in 0s (2421 kB/s)
(Reading database ... 4387 files and directories currently installed.)
9.405 Preparing to unpack .../libc-bin_2.35-0ubuntu3.9_arm64.deb ...
9.417 Unpacking libc-bin (2.35-0ubuntu3.9) over (2.35-0ubuntu3.8) ...
9.663 Setting up libc-bin (2.35-0ubuntu3.9) ...
9.793 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
9.898 Segmentation fault (core dumped)
9.939 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
10.04 Segmentation fault (core dumped)
10.05 dpkg: error processing package libc-bin (--configure):
10.05  installed libc-bin package post-installation script subprocess returned error exit status 139
10.06 Errors were encountered while processing:
10.06  libc-bin
10.13 E: Sub-process /usr/bin/dpkg returned an error code (1)
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:3
--------------------
   1 |     FROM ubuntu:22.04
   2 |     RUN apt-get update
   3 | >>> RUN apt-get install libc-bin
   4 |     
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get install libc-bin" did not complete successfully: exit code: 100
galba@ip-10-90-102-194:~/docker-repro$ cat /etc/os-release

Additional info

No response

@tonistiigi
Copy link
Member

This has been reported as one of the issues in qemu 9.2.0 . You can mitigate by installing emulators in kernel, eg. with https://github.com/docker/setup-qemu-action . https://github.com/tonistiigi/binfmt has qemu-v9.2.2 release that should have patches for this.

@ling-chun
Copy link

same problem

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

3 participants