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

Instructions for Miniforge3 on alpine Linux #219

Closed
1 task done
kellpossible opened this issue Oct 9, 2021 · 7 comments
Closed
1 task done

Instructions for Miniforge3 on alpine Linux #219

kellpossible opened this issue Oct 9, 2021 · 7 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@kellpossible
Copy link

kellpossible commented Oct 9, 2021

Issue:

Miniforge3 installer fails on alpine Linux.

I get the following error:

$ curl -fsSLo Miniforge3.sh https://github.com/conda-forge/miniforge/releases/download/4.10.3-5/Miniforge3-4.10.3-5-$(uname)-$(uname -m).sh
$ bash Miniforge3.sh -b -p ./miniforge3
Miniforge3.sh: line 362: /miniforge3/conda.exe: No such file or directory
Miniforge3.sh: line 365: /miniforge3/preconda.tar.bz2: No such file or directory

You can run this Dockerfile to replicate the problem:

FROM alpine

RUN apk update && apk add curl bash

RUN curl -fsSLo Miniforge3.sh https://github.com/conda-forge/miniforge/releases/download/4.10.3-5/Miniforge3-4.10.3-5-$(uname)-$(uname -m).sh

RUN sha256sum Miniforge3.sh

RUN echo "5f143112b6c9533c550b447cc01f7313a86b6b88b92632791bcb4320e57f9af6  Miniforge3.sh" | sha256sum -c

RUN bash Miniforge3.sh -b -p ./miniforge3
@hmaarrfk
Copy link
Contributor

hmaarrfk commented Oct 9, 2021

we test our installer with a few different docker images. are you able to make a PR adding to the list? you might be missing a system dependency. maybe we will need bz2

@isuruf
Copy link
Member

isuruf commented Oct 9, 2021

We don't support musl libc. You have to install the glibc compat library, if you want to run miniforge.

@kellpossible
Copy link
Author

kellpossible commented Oct 11, 2021

@hmaarrfk Sorry I don't have time at the moment to submit a PR, working around it a different way for now
@isuruf Thanks, I think I got one step closer:

FROM alpine

RUN apk update &&\
	apk add --no-cache curl bash libc6-compat bzip2 &&\
	ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 &&\
	ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2

RUN curl -fsSLo Miniforge3.sh https://github.com/conda-forge/miniforge/releases/download/4.10.3-5/Miniforge3-4.10.3-5-$(uname)-$(uname -m).sh

RUN sha256sum Miniforge3.sh

RUN echo "5f143112b6c9533c550b447cc01f7313a86b6b88b92632791bcb4320e57f9af6  Miniforge3.sh" | sha256sum -c

RUN bash Miniforge3.sh -b -p ./miniforge3
Error relocating /miniforge3/conda.exe: __register_atfork: symbol not found
Error relocating /miniforge3/conda.exe: gnu_dev_minor: symbol not found
Error relocating /miniforge3/conda.exe: __strdup: symbol not found
Error relocating /miniforge3/conda.exe: __vfprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: makecontext: symbol not found
Error relocating /miniforge3/conda.exe: __strncat_chk: symbol not found
Error relocating /miniforge3/conda.exe: __rawmemchr: symbol not found
Error relocating /miniforge3/conda.exe: setcontext: symbol not found
Error relocating /miniforge3/conda.exe: gnu_dev_major: symbol not found
Error relocating /miniforge3/conda.exe: __strncpy_chk: symbol not found
Error relocating /miniforge3/conda.exe: __sprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: __snprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: getcontext: symbol not found
Error relocating /miniforge3/conda.exe: __res_nsearch: symbol not found
Error relocating /miniforge3/conda.exe: __fread_chk: symbol not found
Error relocating /miniforge3/conda.exe: __vsnprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: __strcpy_chk: symbol not found
Error relocating /miniforge3/conda.exe: __strcat_chk: symbol not found
Error relocating /miniforge3/conda.exe: __strtok_r: symbol not found
Error relocating /miniforge3/conda.exe: __asprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: __memset_chk: symbol not found
Error relocating /miniforge3/conda.exe: __fprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: qsort_r: symbol not found
Error relocating /miniforge3/conda.exe: __res_nclose: symbol not found
Error relocating /miniforge3/conda.exe: __memcpy_chk: symbol not found
Error relocating /miniforge3/conda.exe: gnu_dev_makedev: symbol not found
Error relocating /miniforge3/conda.exe: __res_ninit: symbol not found
Error relocating /miniforge3/conda.exe: __vasprintf_chk: symbol not found
Error relocating /miniforge3/conda.exe: __openat_2: symbol not found
Miniforge3.sh: line 365: /miniforge3/preconda.tar.bz2: No such file or directory

@hmaarrfk hmaarrfk changed the title Miniforge3 installer fails on alpine Linux Instructions for Miniforge3 on alpine Linux Oct 18, 2021
@hmaarrfk hmaarrfk added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Oct 18, 2021
@hmaarrfk
Copy link
Contributor

Ok, I've renamed the issue to reflect the current state. and flagged it as "help wanted". If you have information that can help us, it would be great to submit a PR describing how you got things working for others.

@jadeidev
Copy link

we can use the same method used by miniconda using the glibc for alpine

FROM alpine:3.15.0 as alpine-glibc

LABEL src=https://github.com/frol/docker-alpine-glibc
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8

SHELL ["/bin/ash", "-eo", "pipefail", "-c"]

# hadolint ignore=DL3018
RUN ALPINE_GLIBC_BASE_URL="https://github.com/sgerrand/alpine-pkg-glibc/releases/download" && \
    ALPINE_GLIBC_PACKAGE_VERSION="2.34-r0" && \
    ALPINE_GLIBC_BASE_PACKAGE_FILENAME="glibc-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    ALPINE_GLIBC_BIN_PACKAGE_FILENAME="glibc-bin-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    ALPINE_GLIBC_I18N_PACKAGE_FILENAME="glibc-i18n-$ALPINE_GLIBC_PACKAGE_VERSION.apk" && \
    apk add -q --no-cache --virtual=.build-dependencies wget ca-certificates && \
    echo \
    "-----BEGIN PUBLIC KEY-----\
    MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m\
    y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu\
    tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp\
    m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY\
    KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc\
    Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m\
    1QIDAQAB\
    -----END PUBLIC KEY-----" | sed 's/   */\n/g' > "/etc/apk/keys/sgerrand.rsa.pub" && \
    wget -q \
    "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_BASE_URL/$ALPINE_GLIBC_PACKAGE_VERSION/$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
    apk add -q --no-cache \
    "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME" && \
    \
    rm "/etc/apk/keys/sgerrand.rsa.pub" && \
    /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \
    echo "export LANG=$LANG" > /etc/profile.d/locale.sh && \
    \
    apk del -q glibc-i18n && \
    \
    rm "/root/.wget-hsts" && \
    apk del -q .build-dependencies && \
    rm \
    "$ALPINE_GLIBC_BASE_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_BIN_PACKAGE_FILENAME" \
    "$ALPINE_GLIBC_I18N_PACKAGE_FILENAME"


FROM alpine-glibc
ENV PATH /opt/miniforge3/bin:$PATH

RUN apk update && apk add curl bash procps

RUN curl -fsSLo Miniforge3.sh https://github.com/conda-forge/miniforge/releases/download/4.10.3-5/Miniforge3-4.10.3-5-$(uname)-$(uname -m).sh

RUN sha256sum Miniforge3.sh

RUN echo "5f143112b6c9533c550b447cc01f7313a86b6b88b92632791bcb4320e57f9af6  Miniforge3.sh" | sha256sum -c

RUN bash Miniforge3.sh -b -p /opt/miniforge3 &&\
    ln -s /opt/miniforge3/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
    echo ". /opt/miniforge3/etc/profile.d/conda.sh" >> ~/.bashrc && \
    echo "conda activate base" >> ~/.bashrc && \
    find /opt/miniforge3/ -follow -type f -name '*.a' -delete && \
    find /opt/miniforge3/ -follow -type f -name '*.js.map' -delete && \
    /opt/miniforge3/bin/conda clean -afy

CMD ["/bin/bash"]

@andyneff
Copy link

andyneff commented Apr 4, 2024

Additional information:

On glibc 2.35, you will get errors:

Error relocating /tmp/tmp.LpjGOK/conda/_conda: __res_nsearch: symbol not found
Error relocating /tmp/tmp.LpjGOK/conda/_conda: __openat_2: symbol not found

So it appears we need to stick with version 2.34

@isuruf
Copy link
Member

isuruf commented Jul 31, 2024

You can use https://github.com/Docker-Hub-frolvlad/docker-alpine-glibc as the base or use the script there. It also uses 2.34 to workaround sgerrand/alpine-pkg-glibc#176

@isuruf isuruf closed this as completed Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Development

No branches or pull requests

5 participants