sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.05k stars 280 forks source link

trying to overwrite lib64/ld-linux-x86-64.so.2 owned by libc6-compat-1.1.24-r10. #147

Open vbuterin2 opened 3 years ago

epvanhouten commented 3 years ago

I think I'm seeing this same issue. My reproduction is as follows:

Running under Docker version 19.03.5, build 633a0ea838f10e000b7c6d6eed1623e6e988b5bb

FROM alpine:3.13.1
RUN apk add --update curl && \
    GLIBC_VER="2.32-r0" && \
    curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
    curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk && \
    curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk && \
    apk add --no-cache \
                       glibc-${GLIBC_VER}.apk \
                       glibc-bin-${GLIBC_VER}.apk

Results in the following output:

Step 1/2 : FROM alpine:3.13.1
 ---> e50c909a8df2
Step 2/2 : RUN apk add --update curl &&     GLIBC_VER="2.32-r0" &&     curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub &&     curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk &&     curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk &&     apk add --no-cache                        glibc-${GLIBC_VER}.apk
               glibc-bin-${GLIBC_VER}.apk
 ---> Running in 271270c223fd
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20191127-r5)
(2/5) Installing brotli-libs (1.0.9-r3)
(3/5) Installing nghttp2-libs (1.42.0-r1)
(4/5) Installing libcurl (7.74.0-r0)
(5/5) Installing curl (7.74.0-r0)
Executing busybox-1.32.1-r2.trigger
Executing ca-certificates-20191127-r5.trigger
OK: 8 MiB in 19 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/3) Installing glibc (2.32-r0)
(2/3) Installing libgcc (10.2.1_pre1-r3)
(3/3) Installing glibc-bin (2.32-r0)
Executing glibc-bin-2.32-r0.trigger
/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-x86-64.so.2 is not a symbolic link

Using GLIBC_VER="2.29-r0" eliminates the error. Removing attempting to install the glibc-bin-v2.32-r0.apk package also eliminates the error.

pl77 commented 3 years ago

I'm having the same issue. Here's my DOCKERFILE:

FROM python:3.9.2-alpine

# Install language pack
# https://github.com/gliderlabs/docker-alpine/issues/144#issuecomment-436455850

RUN echo "https://dl-3.alpinelinux.org/alpine/v3.13/main" >> /etc/apk/repositories
RUN echo "https://dl-3.alpinelinux.org/alpine/v3.13/community" >> /etc/apk/repositories
ENV LD_LIBRARY_PATH=/lib64

RUN apk --no-cache add --update ca-certificates wget curl && \
    GLIBC_VER="2.32-r0" && \
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk && \
    apk add glibc-bin-${GLIBC_VER}.apk glibc-i18n-${GLIBC_VER}.apk glibc-${GLIBC_VER}.apk

# Iterate through all locale and install it
# Note that locale -a is not available in alpine linux, use `/usr/glibc-compat/bin/locale -a` instead
COPY . /flipp_scraper/
RUN /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8

# Set the lang, you can also specify it as as environment variable through docker-compose.yml
ENV LANG='en_US.UTF-8' LANGUAGE='en_US.UTF-8'

EDiT: Switching to 2.29-r0 also fixed the issue for me as well. Thanks for the suggestion, @epvanhouten !

drbayer commented 3 years ago

Looks like glibc > v2.29 is copying ld-{VERSION}.so to ld-linux-x86-64.so.2 instead of creating a symlink.

Adding this to my Dockerfile after installing glibc fixed the problem for me (use your desired glibc version on line 2):

RUN rm /usr/glibc-compat/lib/ld-linux-x86-64.so.2 && \
    ln -s ld-2.33.so /usr/glibc-compat/lib/ld-linux-x86-64.so.2
KEINOS commented 2 years ago
$ # Alpine v3.15.0 + glibc v2.34-r0 @ 2021/11/30
... ** snip ** ...
(1/2) Installing glibc (2.34-r0)
ERROR: glibc-2.34-r0: trying to overwrite lib64/ld-linux-x86-64.so.2 owned by libc6-compat-1.2.2-r7.

In my case, removing libc6-compat from apk add fixed the issue.

  apk add --no-cache \
-     bash build-base file git gzip ncurses libc6-compat \
+     bash build-base file git gzip ncurses \
  \
  GLIBC_VER="2.34-r0" && \
  wget -q https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -O /etc/apk/keys/sgerrand.rsa.pub && \
  wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk && \
  wget -q https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk && \
  apk add --no-cache \
      glibc-${GLIBC_VER}.apk \
      glibc-bin-${GLIBC_VER}.apk
$ # Alpine v3.15.0 + glibc v2.34-r0 w/out libc6-compat
... **snip ** ...
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/2) Installing glibc (2.34-r0)
(2/2) Installing glibc-bin (2.34-r0)
Executing glibc-bin-2.34-r0.trigger
OK: 234 MiB in 56 packages