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

Error building python 3.6 slim #495

Closed
PhasecoreX opened this issue Dec 29, 2020 · 35 comments
Closed

Error building python 3.6 slim #495

PhasecoreX opened this issue Dec 29, 2020 · 35 comments

Comments

@PhasecoreX
Copy link

I have this Dockerfile:

FROM python:3.6-slim

RUN apt-get update && apt-get install -y --no-install-recommends make

When I run this command:

docker buildx build . --pull --platform linux/arm/v5

I get this output:

WARN[0000] No output specified for 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                                                                                       
[+] Building 27.3s (6/6) FINISHED                                     
 => [internal] load build definition from Dockerfile                                                                                                                                                          0.0s                                                                        
 => => transferring dockerfile: 129B                                                                                                                                                                          0.0s                                                                        
 => [internal] load .dockerignore                                                                                                                                                                             0.0s                                                                        
 => => transferring context: 2B                                                                                                                                                                               0.0s                                                                        
 => [internal] load metadata for docker.io/library/python:3.6-slim                                                                                                                                            0.6s                                                                        
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                                                 0.0s                                                                        
 => CACHED [1/2] FROM docker.io/library/python:3.6-slim@sha256:200bc4213e83751cc4a5496e72573ce8173713fc73266a1fd3ec62bd378a5890                                                                               0.0s                                                                        
 => => resolve docker.io/library/python:3.6-slim@sha256:200bc4213e83751cc4a5496e72573ce8173713fc73266a1fd3ec62bd378a5890                                                                                      0.0s                                                                        
 => ERROR [2/2] RUN apt-get update && apt-get install -y --no-install-recommends make                                                                                                                        26.6s                                                                        
------                                                                
 > [2/2] RUN apt-get update && apt-get install -y --no-install-recommends make:                                                              
#6 0.582 Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]                                                 
#6 0.583 Get:2 http://deb.debian.org/debian buster InRelease [121 kB] 
#6 0.679 Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]                                                               
#6 2.670 Get:4 http://security.debian.org/debian-security buster/updates/main armel Packages [232 kB]                                        
#6 4.570 Get:5 http://deb.debian.org/debian buster/main armel Packages [7627 kB]                                                             
#6 6.556 Get:6 http://deb.debian.org/debian buster-updates/main armel Packages [7860 B]                                                      
#6 8.912 Fetched 8106 kB in 8s (962 kB/s)                             
#6 8.912 Reading package lists...                                     
#6 16.39 Reading package lists...                                     
#6 23.71 Building dependency tree...                                  
#6 24.28 Reading state information...                                 
#6 24.65 Suggested packages:                                          
#6 24.65   make-doc                                                   
#6 25.19 The following NEW packages will be installed:                                                                                       
#6 25.19   make                                                       
#6 25.39 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.                                                                      
#6 25.39 Need to get 327 kB of archives.                              
#6 25.39 After this operation, 1300 kB of additional disk space will be used.                                                                
#6 25.39 Get:1 http://deb.debian.org/debian buster/main armel make armel 4.2.1-1.2 [327 kB]                                                  
#6 26.17 debconf: delaying package configuration, since apt-utils is not installed                                                           
#6 26.29 Fetched 327 kB in 0s (2000 kB/s)                             
#6 26.37 Error while loading /usr/sbin/dpkg-split: No such file or directory                                                                 
#6 26.38 Error while loading /usr/sbin/dpkg-deb: No such file or directory                                                                   
#6 26.38 dpkg: error processing archive /var/cache/apt/archives/make_4.2.1-1.2_armel.deb (--unpack):                                         
#6 26.38  dpkg-deb --control subprocess returned error exit status 1                                                                         
#6 26.40 Errors were encountered while processing:                    
#6 26.40  /var/cache/apt/archives/make_4.2.1-1.2_armel.deb                                                                                   
#6 26.50 E: Sub-process /usr/bin/dpkg returned an error code (1)                                                                             
------                                                                
Dockerfile:3                                                          
--------------------                                                  
   1 |     FROM python:3.6-slim                                       
   2 |                                                                
   3 | >>> RUN apt-get update && apt-get install -y --no-install-recommends make                                                             
   4 |                                                                
--------------------                                                  
error: failed to solve: rpc error: code = Unknown desc = executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update && apt-get install -y --no-install-recommends make]: exit code: 100

Some observations:

It seems like it's looking for /usr/sbin/dpkg-split and /usr/sbin/dpkg-deb, even though those are located in the /usr/bin folder.

Platforms linux/arm/v7 and linux/arm/v8 both fail, however linux/amd64 does not fail.

Changing my Dockerfile to use FROM python:3.6 (instead of slim) builds correctly for all cases (armv5, armv7, arm64v8, amd64), and manually starting a container (after doing the multiarch qemu setup) with docker run -it --rm arm32v5/python:3.6-slim bash allows me to install make just fine.

I wasn't sure if this was a buildx issue or just a python-slim issue, but I was also able to do this as my Dockerfile:

FROM arm32v5/python:3.6-slim

RUN apt-get update && apt-get install -y --no-install-recommends make

and do a regular docker build:

docker build . --pull

and it builds correctly. So my guess is it has something to do with buildx? Unless arm32v5/python:3.6-slim is different than python:3.6-slim that buildx would be pulling.

This might be related to #493, not entirely sure.

@fidesachates
Copy link

I just ran into this as well, but I had builds running just fine 3 months ago. Today I updated my code and ran my build pipeline and this error happened; nothing about my build files changed. Unfortunately in the last 3 months, I probably have ran a number of updates on my build server. I know that's not helpful sadly.

In my case, it's python:3.7-slim and changing to 3.7 doesn't work because I get pip issues in my Dockerfile (I think unrelated)

@JesseBowling
Copy link

JesseBowling commented Jan 4, 2021

I suspect a PATH issue, but only appears to affect ARM builds?

Staring on December 15th, my CI builds started failing to build ARM-based images. Using the following Dockerfile:

FROM ubuntu:18.04

RUN echo ${PATH}
RUN apt-get update
RUN apt-get upgrade -y

Then building with:
docker buildx build --platform linux/arm/v8 --progress=plain .

results in an error:

#4 [1/4] FROM docker.io/library/ubuntu:18.04@sha256:fd25e706f3dea2a5ff705db...
#4 resolve docker.io/library/ubuntu:18.04@sha256:fd25e706f3dea2a5ff705dbc3353cf37f08307798f3e360a13e9385840f73fb3 done
#4 CACHED
#5 [2/4] RUN echo /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/...
#5 0.104 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
<snip>
#7 29.17 debconf: delaying package configuration, since apt-utils is not installed
#7 29.30 Fetched 4565 kB in 18s (255 kB/s)
#7 29.38 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
#7 29.38 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
#7 29.39 dpkg: error processing archive /var/cache/apt/archives/libc6_2.27-3ubuntu1.4_armhf.deb (--unpack):
#7 29.39  dpkg-deb --control subprocess returned error exit status 1
#7 29.40 Errors were encountered while processing:
#7 29.41  /var/cache/apt/archives/libc6_2.27-3ubuntu1.4_armhf.deb
#7 29.51 E: Sub-process /usr/bin/dpkg returned an error code (1)
#7 ERROR: executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get upgrade -y]: exit code: 100

You'll note that /usr/local/sbin is first in the path. If I adjust the PATH to have /usr/bin first in the PATH, the error will "move" and then fail to find tar.

FROM ubuntu:18.04
ENV PATH="/usr/bin:${PATH}"
RUN echo ${PATH}
RUN apt-get update
RUN apt-get upgrade -y

Results in:

#4 [1/4] FROM docker.io/library/ubuntu:18.04@sha256:fd25e706f3dea2a5ff705db...
#4 resolve docker.io/library/ubuntu:18.04@sha256:fd25e706f3dea2a5ff705dbc3353cf37f08307798f3e360a13e9385840f73fb3 done
#4 CACHED

#5 [2/4] RUN echo /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi...
#5 0.102 /usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#5 DONE 0.1s
<snip>
#7 27.33 Fetched 4565 kB in 16s (287 kB/s)
#7 27.50 Error while loading /usr/bin/tar: No such file or directory
#7 27.51 dpkg-deb: error: tar subprocess returned error exit status 1
#7 27.51 dpkg: error processing archive /var/cache/apt/archives/libc6_2.27-3ubuntu1.4_armhf.deb (--unpack):
#7 27.51  dpkg-deb --control subprocess returned error exit status 2
#7 27.53 Errors were encountered while processing:
#7 27.53  /var/cache/apt/archives/libc6_2.27-3ubuntu1.4_armhf.deb
#7 27.63 E: Sub-process /usr/bin/dpkg returned an error code (1)
#7 ERROR: executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get upgrade -y]: exit code: 100

@fidesachates
Copy link

@JesseBowling

In my experimentations, you run into issues if you create a builder. Things work fine if you use the default builder and don't multi platform build (not that you can with the default builder anyway). Is this your experience as well?

@JesseBowling
Copy link

@fidesachates It seems to be specific to armhf (arm/v7 and arm/v8) builds. ARM64 and AMD64 build fine.

I'm not sure if I understand your question enough to give you a more solid answer than that. I can say that I've been primarily using this via Github Actions (i.e., https://github.com/CommunityHoneyNetwork/rdphoney/actions/runs/418797571) and it first broke 22 days ago.

The snippets I provided in the original issue came from trying to recreate the issue as simply as possible on my Macbook, which may well have had a non-default builder.

@fidesachates
Copy link

@JesseBowling I concur arm64 builds work for me as well.

I'm running builds on a ubuntu server. On that server, your examples have no problems for me with or without the PATH edit. Only when I create a docker builder in order to build for more than one platform do I run into these issues (even if I use the created builder to only build for one platform).

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name cibuilder --driver docker-container --use
docker buildx ls
docker buildx inspect --bootstrap

I tried pinning qemu docker image to 5.0.0-5 which was released 4 months ago, but that made no difference.

@JesseBowling
Copy link

Well. Not sure what this implies, but in my CI we were specifying platform targets like so:

DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm/v8,linux/arm64

And it was failing with the above. That was changed to this:

DOCKER_PLATFORMS=linux/amd64,linux/armhf,linux/arm64

and all appears to be working as intended. Not sure what that means, or why things changed 22 days ago, but things are working for me now.

I do wonder what changed to cause this behavior?

@logopk
Copy link

logopk commented Jan 5, 2021

Well. Not sure what this implies, but in my CI we were specifying platform targets like so:

DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm/v8,linux/arm64

And it was failing with the above. That was changed to this:

DOCKER_PLATFORMS=linux/amd64,linux/armhf,linux/arm64

and all appears to be working as intended. Not sure what that means, or why things changed 22 days ago, but things are working for me now.

I do wonder what changed to cause this behavior?

Does not help building linux/arm/v7 on debian or boot2docker.

Interesting that it will work on Docker Desktop 3.0.3 on MacOS BigSur. That uses buildx v0.4.2-docker.

Tried this version but same error.

@logopk
Copy link

logopk commented Jan 5, 2021

The last try lead me to view the buildkitd versions. while both images showed "moby/buildkit:buildx-stable-1", the BigSur-version was loaded 3 months ago and is on version 0.7.2.
The latest on my dev machine is 0.8.1.

@logopk
Copy link

logopk commented Jan 5, 2021

While trying I saw that there is an update to docker 20.10.2.
Don't know if this did the trick, but now it works.

However in the process I also did a
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

@nicobo
Copy link

nicobo commented Jan 11, 2021

Hi everyone

Got my docker updated to latest (20.10.2, Ubuntu) , did the multiarch reset thing, but still get the error...
I've deleted and recreated my builder, rebooted... still the same.

I've tried playing with the PATH, moving binaries, changing base images, then given up...

Any news on this ?

@JesseBowling
Copy link

JesseBowling commented Jan 11, 2021

@nicobo Can you share what architectures you're trying to build for? For me, the issue went away when I switched linux\arm\v8 and linux\arm\v7 to linux\armhf ....

@pcko1
Copy link

pcko1 commented Jan 14, 2021

I am getting the exact same problem when I build with this dockerfile:

# syntax=docker/dockerfile:experimental

FROM arm64v8/ubuntu:latest
RUN apt-get update
RUN apt-get install -y --no-install-recommends
RUN apt-get install -y build-essential
...

which results in:

...
=> ERROR [ 4/20] RUN apt-get install -y build-essential
...
> Error while loading /usr/sbin/dpkg-split: No such file or directory
> Error while loading /usr/sbin/dpkg-deb: No such file or directory
...

For the record, I am cross-building on ubuntu 20.04 / amd64 and for a raspberry pi 4 target machine (ubuntu server 20.10 / arm64) using buildx and the following command:

docker buildx build --platform linux/arm64 -t user/repo --no-cache --pull .

My custom builder looks like this:

NAME/NODE  DRIVER/ENDPOINT             STATUS  PLATFORMS
mybuilder *  docker-container                    
  mybuilder unix:///var/run/docker.sock running linux/arm64*, linux/amd64*, linux/386

Any ideas?

@pcko1
Copy link

pcko1 commented Jan 16, 2021

What actually solved my problem after two painful days was creating the following custom builder:

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap

Now I can successfully run:

docker buildx build --platform linux/arm64 -t user/repo --no-cache --pull .

on my linux/amd64 machine.

@nicobo
Copy link

nicobo commented Jan 16, 2021

@JesseBowling I'm using linux/arm/v7, will try with armhf...

@nicobo
Copy link

nicobo commented Jan 16, 2021

@pcko1 what is the custom part that solves the problem ?

@pcko1
Copy link

pcko1 commented Jan 16, 2021

@pcko1 what is the custom part that solves the problem ?

@nicobo multiarch/qemu-user-static is a custom builder image in itself as it's not provided by default as a builder and you have to download it from dockerhub. Other than that, you only need to change the flag that corresponds to your target architecture before building (in my case linux/arm64).

@nicobo
Copy link

nicobo commented Jan 17, 2021

@pcko1 OK, then I tried it already with no luck. But if I remember well in my case arm64 was not problematic, only armv7

@mietzen
Copy link

mietzen commented Jan 26, 2021

@pcko1 OK, then I tried it already with no luck. But if I remember well in my case arm64 was not problematic, only armv7

We're using ubuntu xenial as base.
I can confirm this, our last successful build was on the 26.01.2021.

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap

Won't help. I'm building linux/arm64 and linux/amd64

$ uname -a
Linux 4.15.0-129-generic #132~16.04.1-Ubuntu SMP Wed Dec 16 06:46:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ docker --version 
Docker version 20.10.2, build 2291f61
13:06:09  #6 29.36 debconf: delaying package configuration, since apt-utils is not installed
13:06:09  #6 29.49 Fetched 106 MB in 5s (20.4 MB/s)
13:06:09  #6 29.56 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.56 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.56 dpkg: error processing archive /var/cache/apt/archives/libatm1_1%3a2.5.1-1.5_arm64.deb (--unpack):
13:06:09  #6 29.56  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.56 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.57 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.57 dpkg: error processing archive /var/cache/apt/archives/libmnl0_1.0.3-5_arm64.deb (--unpack):
13:06:09  #6 29.57  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.57 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.57 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.57 dpkg: error processing archive /var/cache/apt/archives/libpopt0_1.16-10_arm64.deb (--unpack):
13:06:09  #6 29.57  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.57 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.58 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.58 dpkg: error processing archive /var/cache/apt/archives/libssl1.0.0_1.0.2g-1ubuntu4.18_arm64.deb (--unpack):
13:06:09  #6 29.58  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.58 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.58 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.58 dpkg: error processing archive /var/cache/apt/archives/libpython3.5-minimal_3.5.2-2ubuntu0~16.04.12_arm64.deb (--unpack):
13:06:09  #6 29.58  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.58 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.59 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.59 dpkg: error processing archive /var/cache/apt/archives/libexpat1_2.1.0-7ubuntu0.16.04.5_arm64.deb (--unpack):
13:06:09  #6 29.59  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.59 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.59 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.59 dpkg: error processing archive /var/cache/apt/archives/python3.5-minimal_3.5.2-2ubuntu0~16.04.12_arm64.deb (--unpack):
13:06:09  #6 29.59  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.59 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.60 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.60 dpkg: error processing archive /var/cache/apt/archives/python3-minimal_3.5.1-3_arm64.deb (--unpack):
13:06:09  #6 29.60  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.60 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.60 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.60 dpkg: error processing archive /var/cache/apt/archives/mime-support_3.59ubuntu1_all.deb (--unpack):
13:06:09  #6 29.60  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.60 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.61 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.61 dpkg: error processing archive /var/cache/apt/archives/libmpdec2_2.4.2-1_arm64.deb (--unpack):
13:06:09  #6 29.61  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.61 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.61 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.61 dpkg: error processing archive /var/cache/apt/archives/libsqlite3-0_3.11.0-1ubuntu1.5_arm64.deb (--unpack):
13:06:09  #6 29.61  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.62 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.62 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.62 dpkg: error processing archive /var/cache/apt/archives/libpython3.5-stdlib_3.5.2-2ubuntu0~16.04.12_arm64.deb (--unpack):
13:06:09  #6 29.62  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.62 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.62 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.62 dpkg: error processing archive /var/cache/apt/archives/python3.5_3.5.2-2ubuntu0~16.04.12_arm64.deb (--unpack):
13:06:09  #6 29.62  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.63 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.63 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.63 dpkg: error processing archive /var/cache/apt/archives/libpython3-stdlib_3.5.1-3_arm64.deb (--unpack):
13:06:09  #6 29.63  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.63 Error while loading /usr/local/sbin/dpkg-split: No such file or directory
13:06:09  #6 29.63 Error while loading /usr/local/sbin/dpkg-deb: No such file or directory
13:06:09  #6 29.63 dpkg: error processing archive /var/cache/apt/archives/dh-python_2.20151103ubuntu1.2_all.deb (--unpack):
13:06:09  #6 29.63  subprocess dpkg-deb --control returned error exit status 1
13:06:09  #6 29.65 Errors were encountered while processing:
13:06:09  #6 29.65  /var/cache/apt/archives/libatm1_1%3a2.5.1-1.5_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libmnl0_1.0.3-5_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libpopt0_1.16-10_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libssl1.0.0_1.0.2g-1ubuntu4.18_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libpython3.5-minimal_3.5.2-2ubuntu0~16.04.12_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libexpat1_2.1.0-7ubuntu0.16.04.5_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/python3.5-minimal_3.5.2-2ubuntu0~16.04.12_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/python3-minimal_3.5.1-3_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/mime-support_3.59ubuntu1_all.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libmpdec2_2.4.2-1_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libsqlite3-0_3.11.0-1ubuntu1.5_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libpython3.5-stdlib_3.5.2-2ubuntu0~16.04.12_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/python3.5_3.5.2-2ubuntu0~16.04.12_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/libpython3-stdlib_3.5.1-3_arm64.deb
13:06:09  #6 29.65  /var/cache/apt/archives/dh-python_2.20151103ubuntu1.2_all.deb
13:06:09  #6 29.76 E: Sub-process /usr/bin/dpkg returned an error code (1)
13:06:09  #6 ERROR: executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update &&     apt-get install -yq build-essential git libarchive-dev libffi-dev libglib2.0-0 curl     libsdl-image1.2 libsdl1.2-dev libsdl1.2debian libssl-dev locales mesa-common-dev mesa-utils python3 wget     python3-dev python3-pip python3-venv wget libpcap0.8-dev libgvc6]: exit code: 100
13:06:09  
13:06:09  #11 [linux/amd64 2/5] RUN apt-get update &&     apt-get install -yq build-essential git libarchive-dev libffi-dev libglib2.0-0 curl     libsdl-image1.2 libsdl1.2-dev libsdl1.2debian libssl-dev locales mesa-common-dev mesa-utils python3 wget     python3-dev python3-pip python3-venv wget libpcap0.8-dev libgvc6
13:06:09  #11 sha256:434e11e0d91a9948994ec8f22d4ab62effb6a33834dd90fcf110f073bf5c5518
13:06:09  #11 CANCELED
13:06:09  ------
13:06:09   > [linux/arm64 2/5] RUN apt-get update &&     apt-get install -yq build-essential git libarchive-dev libffi-dev libglib2.0-0 curl     libsdl-image1.2 libsdl1.2-dev libsdl1.2debian libssl-dev locales mesa-common-dev mesa-utils python3 wget     python3-dev python3-pip python3-venv wget libpcap0.8-dev libgvc6:
13:06:09  ------
13:06:09  Dockerfile:7
13:06:09  --------------------
13:06:09     6 |     
13:06:09     7 | >>> RUN apt-get update && \
13:06:09     8 | >>>     apt-get install -yq build-essential git libarchive-dev libffi-dev libglib2.0-0 curl \
13:06:09     9 | >>>     libsdl-image1.2 libsdl1.2-dev libsdl1.2debian libssl-dev locales mesa-common-dev mesa-utils python3 wget \
13:06:09    10 | >>>     python3-dev python3-pip python3-venv wget libpcap0.8-dev libgvc6
13:06:09    11 |     
13:06:09  --------------------
13:06:09  error: failed to solve: rpc error: code = Unknown desc = executor failed running [/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update &&     apt-get install -yq build-essential git libarchive-dev libffi-dev libglib2.0-0 curl     libsdl-image1.2 libsdl1.2-dev libsdl1.2debian libssl-dev locales mesa-common-dev mesa-utils python3 wget     python3-dev python3-pip python3-venv wget libpcap0.8-dev libgvc6]: exit code: 100

@PhasecoreX
Copy link
Author

Just an update after reading though all the comments here and trying out some solutions:

I am primarily using GitHub Actions to do my building with Buildx, hopefully what I was able to reproduce on my own machine closely matches what GitHub Actions was doing. I realized that the list of Buildx platforms supported in GitHub Actions did not include linux/arm/v5. Once I removed that from my build workflow, the build was successful!

It's weird, because having linux/arm/v5 didn't break things before, but perhaps some change happened 2 months ago and now it does break. Probably for the best though, as I'm going to assume whatever was being built might not have been guaranteed to be arm/v5 compatible? Also interestingly, linux/arm/v5 works just fine for python:3.6 (not slim) with the example Dockerfile I provided (I tested it today). So I'm not sure what's going on there.

At any rate, it seems that if I use the platforms that Buildx reports are supported, all should be good (assuming the base image also was built with it). At the time of writing, GitHub Actions docker/setup-buildx-action@v1 supports linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, and linux/arm/v6.

@nicobo
Copy link

nicobo commented Jan 27, 2021

@PhasecoreX yes I think in my case it was also an issue with the list of supported architectures that was inconsistent between the base images and the emulator's ones.

@atam003
Copy link

atam003 commented Jan 28, 2021

I am also facing the same issue with ubuntu18.04 with platform linux/arm64.
I read the full thread. What is the correct resolution, I didn't get?

@ayk33
Copy link

ayk33 commented Feb 17, 2022

Just in case you are using Github Actions and the were trying the workarounds mentioned earlier, there may be a much more obvious solution for you: use the docker/setup-qemu-action in a step before setting up Docker Buildx:

      - name: Set up QEMU
        id: qemu
        uses: docker/setup-qemu-action@v1
        with:
          image: tonistiigi/binfmt:latest
          platforms: all

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v1

This at least solved it for me – without any further workarounds like symlinking from /usr/bin to /usr/sbin.

Bump on this! Worked for me. I would just recommend not using latest.

@mosheavni
Copy link

Also experiencing this on a daemonless build.
What can I do in my case?

QuinnJensen pushed a commit to QuinnJensen/nlan-docker that referenced this issue Mar 24, 2022
jibon57 referenced this issue in mynaparrot/plugNmeet-server May 3, 2022
dfuchss added a commit to dfuchss/synapse-arm that referenced this issue May 30, 2022
Try to fix docker buildx by using suggestion from docker/buildx#495 (comment)
417-72KI added a commit to 417-72KI/Docker-Swift-Mint that referenced this issue Jun 2, 2022
willat8 added a commit to willat8/docker-shepherd that referenced this issue Jul 4, 2022
dictcp added a commit to dictcp/fexemu-on-docker that referenced this issue Aug 22, 2022
@REPLicated
Copy link

REPLicated commented Dec 20, 2022

I investigated a similar issue (same error message) and came to the following conclusion:

  • The problem is often not with the binfmt registration itself as suggested above and elsewhere.
  • Instead, older Debian and Ubuntu releases ship a broken/bastardized qemu. They apply loads of custom patches on top of upstream qemu, one of which presumably breaks the emulation. E.g. on Ubuntu 18.04 which ships the old qemu release 2.11.1 I get these apt-get crashes. When compiling the same qemu version from the upstream sources (without Debian/Ubuntu patches), it works fine.
  • The reason why workarounds like docker run --rm --privileged multiarch/qemu-user-static --reset -p yes help here, is because they force the kernel to load working qemu binaries contained within the Docker image instead of taking the system's broken qemu. Beware that you are effectively loading third-party binaries as root, which are nowhere to be found on the host's disk after the container stops (they live in-memory).

obol-bulldozer bot pushed a commit to ObolNetwork/charon that referenced this issue Mar 22, 2024
Some packages installed from the Dockerfile failed after #2971 was merged. Reason was it used default pre-installed version of qemu - the emulator used from amd64 architecture to build the arm64 images. Qemu is suggested by Dockerhub as well.

[Dockerhub](https://docs.docker.com/build/ci/github-actions/multi-platform/)
[Github Issue](docker/buildx#495 (comment))

category: fixbuild
ticket: none
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