Skip to content

The Debian packages using the wrong architecture, etc in the official container #342

@mbrancato

Description

@mbrancato

Debian defines the all architecture as:

all, which indicates an architecture-independent package.

The official Google SDK Debian containers are using Google packages from https://packages.cloud.google.com/apt:

echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" > /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && \

The packages installed here listed as the all architecture but they install a compiled "bundled" python version

% docker run -it --rm --entrypoint bash gcr.io/google.com/cloudsdktool/google-cloud-cli:slim
root@47873efdfdd7:/# ls -la /usr/lib/google-cloud-sdk/platform/bundledpythonunix/{bin,lib}/
/usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/:
total 104
drwxr-xr-x 2 root root  4096 Sep 12 10:36 .
drwxr-xr-x 6 root root  4096 Sep 12 10:36 ..
-rwxr-xr-x 1 root root   127 Jan  1  1980 2to3
-rwxr-xr-x 1 root root   127 Jan  1  1980 2to3-3.9
-rwxr-xr-x 1 root root   125 Jan  1  1980 idle3
-rwxr-xr-x 1 root root   125 Jan  1  1980 idle3.9
-rwxr-xr-x 1 root root   975 Jan  1  1980 pip
-rwxr-xr-x 1 root root   977 Jan  1  1980 pip3
-rwxr-xr-x 1 root root   981 Jan  1  1980 pip3.9
-rwxr-xr-x 1 root root   110 Jan  1  1980 pydoc3
-rwxr-xr-x 1 root root   110 Jan  1  1980 pydoc3.9
-rwxr-xr-x 1 root root 20744 Jan  1  1980 python3
-rwxr-xr-x 1 root root  3198 Jan  1  1980 python3-config
-rwxr-xr-x 1 root root 20744 Jan  1  1980 python3.9
-rwxr-xr-x 1 root root  3198 Jan  1  1980 python3.9-config
-rwxr-xr-x 1 root root   238 Jan  1  1980 wheel

/usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/:
total 113536
drwxr-xr-x  6 root root     4096 Sep 12 10:36 .
drwxr-xr-x  6 root root     4096 Sep 12 10:36 ..
-rw-r--r--  1 root root 38618228 Sep  1 15:28 libpython3.9.a
-rw-r--r--  1 root root 38795392 Jan  1  1980 libpython3.9.so
-rw-r--r--  1 root root 38795392 Jan  1  1980 libpython3.9.so.1.0
-rw-r--r--  1 root root    16680 Jan  1  1980 libpython3.so
drwxr-xr-x  2 root root     4096 Sep 12 10:36 pkgconfig
drwxr-xr-x 30 root root     4096 Sep 12 10:36 python3.9
drwxr-xr-x  5 root root     4096 Sep 12 10:36 tcl8
drwxr-xr-x  2 root root     4096 Sep 12 10:36 thread2.8.5

The Debian packages require Python to be installed, but do not specify Python as a package dependency

python3-dev \
python3-pip \

No dependencies listed:

% docker run -it --rm --entrypoint bash gcr.io/google.com/cloudsdktool/google-cloud-cli:slim
root@47873efdfdd7:/# apt show google-cloud-cli
Package: google-cloud-cli
Version: 445.0.0-0
Priority: optional
Section: misc
Maintainer: Google Cloud CLI Authors <https://code.google.com/p/google-cloud-sdk/>
Installed-Size: 756 MB
Suggests: google-cloud-cli-app-engine-java, google-cloud-cli-app-engine-python, google-cloud-cli-pubsub-emulator, google-cloud-cli-bigtable-emulator, google-cloud-cli-datastore-emulator, kubectl
Conflicts: gsutil
Homepage: https://cloud.google.com/sdk/
Download-Size: 153 MB
APT-Manual-Installed: yes
APT-Sources: https://packages.cloud.google.com/apt cloud-sdk-bullseye/main amd64 Packages
Description: Utilities for the Google Cloud Platform

Google is installing x86_64 binaries in the arm64 docker container

docker run -it --rm gcr.io/google.com/cloudsdktool/google-cloud-cli:slim bash -c 'apt-get update -y && apt-get install -y file && set -x && file /usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/python3 && dpkg --print-architecture && dpkg -l | grep google-cloud-cli'
Unable to find image 'gcr.io/google.com/cloudsdktool/google-cloud-cli:slim' locally
slim: Pulling from google.com/cloudsdktool/google-cloud-cli
f96ab1515704: Already exists 
...
Digest: sha256:83cb2f320af99e00998d7f8495af331c16bee826b90820141b6c99510069b3e1
Status: Downloaded newer image for gcr.io/google.com/cloudsdktool/google-cloud-cli:slim
...
+ file /usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/python3
/usr/lib/google-cloud-sdk/platform/bundledpythonunix/bin/python3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, with debug_info, not stripped
+ dpkg --print-architecture
arm64
+ dpkg -l
+ grep google-cloud-cli
ii  google-cloud-cli           445.0.0-0                      all          Utilities for the Google Cloud Platform

The Debian packaging works without dependencies on x86_64, but not on arm64. And its installing x86_64 binaries on every architecture.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions