sgerrand/alpine-pkg-glibc

ERROR: gcompat-1.1.0-r4: trying to overwrite lib/ld-linux-x86-64.so.2 owned by glibc-2.35-r1.

Opened this issue · 10 comments

This happened when I am trying to install glibc-bin-2.35-r1.apk and glibc-i18n-2.35-r1.apk

$ sudo apk add glibc-2.35-r1.apk
[sudo] password for user:
OK: 432 MiB in 105 packages
$ sudo apk add glibc-bin-2.35-r1.apk glibc-i18n-2.35-r1.apk
(1/5) Installing musl-obstack (1.2.3-r2)
(2/5) Installing libucontext (1.2-r2)
(3/5) Installing gcompat (1.1.0-r4)
ERROR: gcompat-1.1.0-r4: trying to overwrite lib/ld-linux-x86-64.so.2 owned by glibc-2.35-r1.
(4/5) Installing glibc-bin (2.35-r1)
(5/5) Installing glibc-i18n (2.35-r1)
Executing glibc-bin-2.35-r1.trigger
1 error; 461 MiB in 110 packages

I have the same issue

While I do not use this project - I've rolled my own, very similar image - it might be interesting to know that I think this causes the following error:

Error loading Python lib '/usr/local/aws-cli/v2/dist/libpython3.11.so.1.0': dlopen: Error relocating /usr/local/aws-cli/v2/dist/libpython3.11.so.1.0: posix_fallocate64: symbol not found

I just went back to Alpine 3.18 and GLIBC 2.31-r0.

I tried with Alpine 3.19 and GLIB 2.31-r0 too - and ended up with a segfault when I used the AWS CLI (v2)

Once again - please not that I'm not sure this is the cause. I'm just trying to be helpful.

I found a workaround to avoid the problem and installed gcombat beforehand in the build environment. After installing glibc, I removed the dependency from the build environment again and started installing glibc-bin and glibc-i18n.

To see how it works, I have prepared a code snippet to explain the integration into the Alpine 3.19 container.

ARG GLIBC_VER="2.35-r1"
ARG ALPINE_GLIBC_REPO="https://github.com/sgerrand/alpine-pkg-glibc/releases/download"
ARG SGERRAND_RSA_SHA256="823b54589c93b02497f1ba4dc622eaef9c813e6b0f0ebbb2f771e32adf9f4ef2"
RUN apk add --no-cache --virtual .build-deps curl binutils zstd gcompat && \
    curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
    echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk && \
    apk add --force-overwrite --no-cache /tmp/glibc-${GLIBC_VER}.apk && \
    apk del gcompat && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk && \
    curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk

I found a workaround to avoid the problem and installed gcombat beforehand in the build environment. After installing glibc, I removed the dependency from the build environment again and started installing glibc-bin and glibc-i18n.

To see how it works, I have prepared a code snippet to explain the integration into the Alpine 3.19 container.

ARG GLIBC_VER="2.35-r1"
RUN apk add --no-cache --virtual .build-deps curl binutils zstd gcompat && \
    curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
    echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk && \
    apk add --force-overwrite --no-cache /tmp/glibc-${GLIBC_VER}.apk && \
    apk del gcompat && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk && \
    curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk

Thanks this was helpful!

EloB commented

I'm trying to use this with aws-sam-cli. Anyone had progress with this? I'm facing the same issue with posix_fallocate64: symbol not found.

I'm trying to use this with aws-sam-cli. Anyone had progress with this? I'm facing the same issue with posix_fallocate64: symbol not found.

Do you have a corresponding docker example? I would check out if I can find a workaround.

EloB commented

@ZPascal Not really. Right now I'm just trying out with docker run -it --rm alpine:3.19 /bin/sh.

apk add --no-cache gcompat
cd /tmp/
wget https://github.com/aws/aws-sam-cli/releases/download/v1.109.0/aws-sam-cli-linux-arm64.zip -O sam.zip
unzip sam.zip -d sam
./sam/install

I'm getting this error:

[16] Error loading Python lib '/tmp/sam/dist/_internal/libpython3.11.so.1.0': dlopen: Error relocating /tmp/sam/dist/_internal/libpython3.11.so.1.0: posix_fallocate64: symbol not found

I'm a bit unsure how I can use that:

apk add --no-cache --virtual .build-deps curl binutils zstd gcompat && \
    curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
    echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk && \
    apk add --force-overwrite --no-cache /tmp/glibc-${GLIBC_VER}.apk && \
    apk del gcompat && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk && \
    curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk

@ZPascal Not really. Right now I'm just trying out with docker run -it --rm alpine:3.19 /bin/sh.

apk add --no-cache gcompat
cd /tmp/
wget https://github.com/aws/aws-sam-cli/releases/download/v1.109.0/aws-sam-cli-linux-arm64.zip -O sam.zip
unzip sam.zip -d sam
./sam/install

I'm getting this error:

[16] Error loading Python lib '/tmp/sam/dist/_internal/libpython3.11.so.1.0': dlopen: Error relocating /tmp/sam/dist/_internal/libpython3.11.so.1.0: posix_fallocate64: symbol not found

I'm a bit unsure how I can use that:

apk add --no-cache --virtual .build-deps curl binutils zstd gcompat && \
    curl -LfsS https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
    echo "${SGERRAND_RSA_SHA256} */etc/apk/keys/sgerrand.rsa.pub" | sha256sum -c - && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-${GLIBC_VER}.apk > /tmp/glibc-${GLIBC_VER}.apk && \
    apk add --force-overwrite --no-cache /tmp/glibc-${GLIBC_VER}.apk && \
    apk del gcompat && \
    curl -LfsS ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk > /tmp/glibc-bin-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-bin-${GLIBC_VER}.apk && \
    curl -Ls ${ALPINE_GLIBC_REPO}/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk > /tmp/glibc-i18n-${GLIBC_VER}.apk && \
    apk add --no-cache /tmp/glibc-i18n-${GLIBC_VER}.apk

@EloB Are you sure that the CLI works out of the box with MUSL and without Python? I think, your issue is not related to this case, but I'll try to help you.

EloB commented

@ZPascal This isn't my type of expertise. I was able to run the sam cli using pip install aws-sam-cli but that is using python right and not as an binary?

Thanks for the help :)

@ZPascal This isn't my type of expertise. I was able to run the sam cli using pip install aws-sam-cli but that is using python right and not as an binary?

Thanks for the help :)

Hi @EloB, I think the source/ binary version also uses Python dependencies.

I've prepared a repository and containers that include docker containers for the SAM CLI based on Alpine and Distroless Debian 12 base images. Unfortunately, it was not possible to use Alpine for the source/ binary version, because of missing hard-linked C dependencies.

I think, your problem is in general not related to the issue discussed in this thread. If you have further questions, please open a follow-up issue on the new repository.