docker/buildx

Error building python 3.6 slim

Closed this issue ยท 35 comments

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.

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)

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

@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?

@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.

@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.

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?

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.

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.

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

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 ?

@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 commented

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 commented

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.

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

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

pcko1 commented

@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).

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

@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

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.

@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.

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?

@atam003 from my understanding : check that all your images, including the ones used by the builders, support all the invoked CPU architectures.

docker buildx ls will print this info for your current builders

@atam003 from my understanding : check that all your images, including the ones used by the builders, support all the invoked CPU architectures.

docker buildx ls will print this info for your current builders

But why was is it working before the system update?

I can confirm this, our last successful build was on the 26.01.2021.

I wouldn't see this Issue as closed or fixed.

@nicobo I verified, everything was correct. For debug I used only single platform i.e. linux/arm64

@atam003 Perhaps we should open a new more generic ticket, since this does not only affect python 3.6 slim and refer to this one?

There have been already similar issues -
moby/buildkit#1929
moby/buildkit#1943

junka commented

don't know the root cause,
add these in dockerfile would help

RUN ln -s /usr/bin/dpkg-split /usr/sbin/dpkg-split
RUN ln -s /usr/bin/dpkg-deb /usr/sbin/dpkg-deb
RUN ln -s /bin/tar /usr/sbin/tar

soft link path could be different

@pcko1 your suggestion resolved my issue also, cheers mate! :)

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

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.

In my case running:

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

once again to update the previous installation fixed the issues.

Found the same problem when I tried to build arm64 image and included apt-get install iputils-ping in my Dockerfile (my base image is openjdk:11-jre-slim, however).

The solution proposed by pcko1 didn't work for me but the solution proposed by junka worked.
Just adding several soft links before apt-get:

RUN ln -s /usr/bin/dpkg-split /usr/sbin/dpkg-split
RUN ln -s /usr/bin/dpkg-deb /usr/sbin/dpkg-deb
RUN ln -s /bin/rm /usr/sbin/rm
RUN ln -s /bin/tar /usr/sbin/tar

It's even more confusing when I found I can apt-get directly inside container running on raspberrypi.

pi@raspberrypi:~ $ sudo docker run  --privileged -it --rm openjdk:11-jre-slim-bullseye sh -c " apt-get update && apt-get install -y iputils-ping && ping -c 4 www.baidu.com"
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main arm64 Packages [97.0 kB]
Get:5 http://deb.debian.org/debian bullseye/main arm64 Packages [8068 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main arm64 Packages [2600 B]                                         
Fetched 8367 kB in 45s (188 kB/s)                                                                                        
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libcap2 libcap2-bin libpam-cap
The following NEW packages will be installed:
  iputils-ping libcap2 libcap2-bin libpam-cap
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 119 kB of archives.
After this operation, 315 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main arm64 libcap2 arm64 1:2.44-1 [23.2 kB]
Get:2 http://deb.debian.org/debian bullseye/main arm64 libcap2-bin arm64 1:2.44-1 [32.0 kB]
Get:3 http://deb.debian.org/debian bullseye/main arm64 iputils-ping arm64 3:20210202-1 [48.3 kB]
Get:4 http://deb.debian.org/debian bullseye/main arm64 libpam-cap arm64 1:2.44-1 [15.5 kB]
Fetched 119 kB in 0s (458 kB/s)    
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap2:arm64.
(Reading database ... 7055 files and directories currently installed.)
Preparing to unpack .../libcap2_1%3a2.44-1_arm64.deb ...
Unpacking libcap2:arm64 (1:2.44-1) ...
Selecting previously unselected package libcap2-bin.
Preparing to unpack .../libcap2-bin_1%3a2.44-1_arm64.deb ...
Unpacking libcap2-bin (1:2.44-1) ...
Selecting previously unselected package iputils-ping.
Preparing to unpack .../iputils-ping_3%3a20210202-1_arm64.deb ...
Unpacking iputils-ping (3:20210202-1) ...
Selecting previously unselected package libpam-cap:arm64.
Preparing to unpack .../libpam-cap_1%3a2.44-1_arm64.deb ...
Unpacking libpam-cap:arm64 (1:2.44-1) ...
Setting up libcap2:arm64 (1:2.44-1) ...
Setting up libcap2-bin (1:2.44-1) ...
Setting up libpam-cap:arm64 (1:2.44-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 78.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/aarch64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/aarch64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/aarch64-linux-gnu/perl-base /usr/lib/aarch64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up iputils-ping (3:20210202-1) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
PING www.a.shifen.com (182.61.200.7) 56(84) bytes of data.
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=1 ttl=51 time=6.87 ms
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=2 ttl=51 time=14.6 ms
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=3 ttl=51 time=11.4 ms
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=4 ttl=51 time=4.49 ms

--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 4.485/9.329/14.598/3.917 ms
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v8+ #1414 SMP PREEMPT Fri Apr 30 13:23:25 BST 2021 aarch64 GNU/Linux

@rxue92 I just had the same problem. You should have a look at /proc/sys/fs/binfmt_misc/ and see if there are conflicting entries for the same architecture (arm64 in your case). I found a duplicate and remove the non-qemu one like this:

docker run --privileged --rm tonistiigi/binfmt --uninstall armv7l-linux

In my case, it was an entry created by the OS for cross-compiling, so I had to remove it in order to get the docker builds working.

ayk33 commented

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.

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

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).