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

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

Open
mbrancato opened this issue Sep 12, 2023 · 1 comment

Comments

@mbrancato
Copy link

mbrancato commented Sep 12, 2023

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.

@mbrancato
Copy link
Author

mbrancato commented Sep 12, 2023

The "slim" container is an extra 70M+ 100M+ in size by including static libs and not using symlinks

/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
root@47873efdfdd7:/tmp# apt-get download google-cloud-cli
Get:1 https://packages.cloud.google.com/apt cloud-sdk-bullseye/main amd64 google-cloud-cli all 445.0.0-0 [153 MB]
root@47873efdfdd7:/tmp# ar x google-cloud-cli_445.0.0-0_all.deb
root@47873efdfdd7:/tmp# tar -tvf data.tar.xz | grep libpython3.9
-rw-r--r-- root/root  38618228 2023-09-01 15:28 ./usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a
-rw-r--r-- root/root  38795392 1980-01-01 08:00 ./usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/libpython3.9.so
-rw-r--r-- root/root  38618228 2023-09-01 15:28 ./usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/libpython3.9.a
-rw-r--r-- root/root  38795392 1980-01-01 08:00 ./usr/lib/google-cloud-sdk/platform/bundledpythonunix/lib/libpython3.9.so.1.0

@mbrancato mbrancato changed the title Why are the Debian packages using the wrong architecture, etc in the official container? The Debian packages using the wrong architecture, etc in the official container Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant