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

Failed to install software-properties-common when use ubuntu 22.04 base image #3043

Closed
3 tasks done
daviderli614 opened this issue Mar 4, 2025 · 2 comments
Closed
3 tasks done

Comments

@daviderli614
Copy link

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

An error occurred when using ubuntu 22.04 amd64 machine building arm64 image:

Dockerfile:9
--------------------
   8 |
   9 | >>> RUN apt-get update && \
  10 | >>>     DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
  11 |     # Install dependencies.
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common" did not complete successfully: exit code: 100

Seems software-properties-common install failed?

Expected behaviour

Successfully built arm64 image.

Actual behaviour

Building from a Dockerfile:

  1. Login to ubuntu 22.04 amd64 machine
  2. git clone https://github.com/GreptimeTeam/greptimedb.git
  3. cd greptimedb/
docker buildx build --builder gtbuilder \
  --build-arg="RUST_TOOLCHAIN=nightly-2024-12-25" \
  -f docker/dev-builder/ubuntu/Dockerfile \
  -t docker.io/greptime/dev-builder-ubuntu:test --platform linux/arm64 .

build error in: apt-get install -y software-properties-common

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:9
--------------------
   8 |
   9 | >>> RUN apt-get update && \
  10 | >>>     DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
  11 |     # Install dependencies.
--------------------
ERROR: failed to solve: process "/dev/.buildkit_qemu_emulator /bin/sh -c apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common" did not complete successfully: exit code: 100

dockerfile: https://github.com/GreptimeTeam/greptimedb/blob/main/docker/dev-builder/ubuntu/Dockerfile

but modify --platform to linux/amd64 is successful:

docker buildx build --builder gtbuilder \
  --build-arg="RUST_TOOLCHAIN=nightly-2024-12-25" \
  -f docker/dev-builder/ubuntu/Dockerfile \
  -t docker.io/greptime/dev-builder-ubuntu:test --platform linux/amd64 .

amd64 platform build logs:

docker buildx build --builder gtbuilder   --build-arg="RUST_TOOLCHAIN=nightly-2024-12-25"   -f docker/dev-builder/ubuntu/Dockerfile   -t docker.io/greptime/dev-builder-ubuntu:test --platform linux/amd64 .
[+] Building 124.7s (18/18) FINISHED                                                                                                       docker-container:gtbuilder
 => [internal] load build definition from Dockerfile                                                                                                             0.0s
 => => transferring dockerfile: 3.25kB                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04                                                                                                  1.3s
 => [internal] load .dockerignore                                                                                                                                0.0s
 => => transferring context: 277B                                                                                                                                0.0s
 => [ 1/14] FROM docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                          0.0s
 => => resolve docker.io/library/ubuntu:22.04@sha256:ed1544e454989078f5dec1bfdabd8c5cc9c48e0705d07b678ab6ae3fb61952d2                                            0.0s
 => [internal] load build context                                                                                                                                0.0s
 => => transferring context: 177B                                                                                                                                0.0s
 => CACHED [ 2/14] WORKDIR /greptimedb                                                                                                                           0.0s
 => [ 3/14] RUN apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common                                              33.6s
 => [ 4/14] RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y     libssl-dev     tzdata     curl     unzip     ca-certificates     git    24.8s
 => [ 5/14] RUN echo "target platform: linux/amd64"                                                                                                              0.1s
 => [ 6/14] RUN if [ "linux/amd64" = "linux/arm64" ]; then     curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v29.3/protoc-29.3-linux-a  2.0s
 => [ 7/14] RUN mv protoc3/bin/* /usr/local/bin/                                                                                                                 0.1s
 => [ 8/14] RUN mv protoc3/include/* /usr/local/include/                                                                                                         0.1s
 => [ 9/14] RUN git config --global --add safe.directory '*'                                                                                                     0.1s
 => [10/14] RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y                                1.0s
 => [11/14] RUN rustup toolchain install nightly-2024-12-25                                                                                                     50.3s
 => [12/14] COPY ./docker/dev-builder/binstall/pull_binstall.sh /usr/local/bin/pull_binstall.sh                                                                  0.3s
 => [13/14] RUN chmod +x /usr/local/bin/pull_binstall.sh && /usr/local/bin/pull_binstall.sh                                                                      7.2s
 => [14/14] RUN cargo binstall cargo-nextest --no-confirm                                                                                                        3.7s
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

Buildx version

github.com/docker/buildx v0.16.1 34c195271a3f6dc64814db71438dc50dd41d7e3e

Docker info

Client:
 Version:    27.2.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.20.3
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 1
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 27.2.0
 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: 472731909fa34bd7bc9c087e4c27943f9835f111
 runc version:
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-1024-gcp
 Operating System: Ubuntu Core 22
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.34GiB
 Name: debug-amd64
 ID: 22ef975d-f81c-4798-a4cd-3015600562b4
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Builders list

NAME/NODE        DRIVER/ENDPOINT                   STATUS    BUILDKIT   PLATFORMS
gtbuilder*       docker-container
 \_ gtbuilder0    \_ unix:///var/run/docker.sock   running   v0.20.0    linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386
default          docker
 \_ default       \_ default                       running   v0.15.2    linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/amd64/v4, linux/386

Configuration

FROM ubuntu:22.04

# The root path under which contains all the dependencies to build this Dockerfile.
ARG DOCKER_BUILD_ROOT=.

ENV LANG en_US.utf8
WORKDIR /greptimedb

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt install -y software-properties-common
# Install dependencies.
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    libssl-dev \
    tzdata \
    curl \
    unzip \
    ca-certificates \
    git \
    build-essential \
    pkg-config

ARG TARGETPLATFORM
RUN echo "target platform: $TARGETPLATFORM"

ARG PROTOBUF_VERSION=29.3

# Install protobuf, because the one in the apt is too old (v3.12).
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
    curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-aarch_64.zip && \
    unzip protoc-${PROTOBUF_VERSION}-linux-aarch_64.zip -d protoc3; \
elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
    curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
    unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d protoc3; \
fi
RUN mv protoc3/bin/* /usr/local/bin/
RUN mv protoc3/include/* /usr/local/include/

# Silence all `safe.directory` warnings, to avoid the "detect dubious repository" error when building with submodules.
# Disabling the safe directory check here won't pose extra security issues, because in our usage for this dev build
# image, we use it solely on our own environment (that github action's VM, or ECS created dynamically by ourselves),
# and the repositories are pulled from trusted sources (still us, of course). Doing so does not violate the intention
# of the Git's addition to the "safe.directory" at the first place (see the commit message here:
# https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9).
# There's also another solution to this, that we add the desired submodules to the safe directory, instead of using
# wildcard here. However, that requires the git's config files and the submodules all owned by the very same user.
# It's troublesome to do this since the dev build runs in Docker, which is under user "root"; while outside the Docker,
# it can be a different user that have prepared the submodules.
RUN git config --global --add safe.directory '*'

# Install Rust.
SHELL ["/bin/bash", "-c"]
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
ENV PATH /root/.cargo/bin/:$PATH

# Install Rust toolchains.
ARG RUST_TOOLCHAIN
RUN rustup toolchain install ${RUST_TOOLCHAIN}

# Install cargo-binstall with a specific version to adapt the current rust toolchain.
# Note: if we use the latest version, we may encounter the following `use of unstable library feature 'io_error_downcast'` error.
# compile from source take too long, so we use the precompiled binary instead
COPY $DOCKER_BUILD_ROOT/docker/dev-builder/binstall/pull_binstall.sh /usr/local/bin/pull_binstall.sh
RUN chmod +x /usr/local/bin/pull_binstall.sh && /usr/local/bin/pull_binstall.sh

# Install nextest.
RUN cargo binstall cargo-nextest --no-confirm

Build logs


Additional info

uname -a

Linux debug-amd64 6.8.0-1024-gcp #26~22.04.1-Ubuntu SMP Thu Feb  6 19:17:51 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Google Compute Engine Machine configuration:

Image

@daviderli614
Copy link
Author

build-logs.txt

@tonistiigi
Copy link
Member

261.7 Processing triggers for libc-bin (2.35-0ubuntu3.8) ...
261.8 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
261.9 Segmentation fault (core dumped)
262.0 qemu: uncaught target signal 11 (Segmentation fault) - core dumped
262.1 Segmentation fault (core dumped)

moby/buildkit#5783

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