Pixi does not work in Alpine (or with muslc)
Checks
-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
FROM alpine
WORKDIR /test
RUN apk update --no-cache && apk add file
RUN wget https://github.com/prefix-dev/pixi/releases/download/v0.44.0/pixi-x86_64-unknown-linux-musl.tar.gz
RUN tar -xzf pixi-x86_64-unknown-linux-musl.tar.gz -C /usr/local/bin
docker run -it --rm $(docker build -t test --no-cache --quiet .)
/test # ldd /usr/local/bin/pixi
/lib/ld-musl-x86_64.so.1 (0x70c002f99000)
/test # file /usr/local/bin/pixi
/usr/local/bin/pixi: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=31448c7de10dc4da60ce8e7fcabcd73ddfbd6c41, stripped
/test # which pixi
/usr/local/bin/pixi
/test # ldd pixi
/lib/ld-musl-x86_64.so.1: cannot load pixi: No such file or directory
/test # file pixi
pixi: cannot open `pixi' (No such file or directory)
/test # pixi info
System
------------
Pixi version: 0.44.0
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.13.8=0
: __archspec=1=zen3
Cache dir: /root/.cache/rattler/cache
Auth storage: /root/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /root/.pixi/bin
Environment dir: /root/.pixi/envs
Manifest dir: /root/.pixi/manifests/pixi-global.toml
/test # pixi exec python
Error: x failed to run activation
`-> No such file or directory (os error 2)
I'm not sure what's going on with the linking, but if you do the same checks on the Ubuntu images, ldd says the binary is statically linked:
docker run -it --rm ghcr.io/prefix-dev/pixi:0.44.0
root@7756ce0dc1a3:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
root@7756ce0dc1a3:/# pixi info
System
------------
Pixi version: 0.44.0
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.13.8=0
: __glibc=2.39=0
: __archspec=1=zen3
Cache dir: /root/.cache/rattler/cache
Auth storage: /root/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /root/.pixi/bin
Environment dir: /root/.pixi/envs
Manifest dir: /root/.pixi/manifests/pixi-global.toml
root@7756ce0dc1a3:/# file /usr/local/bin/pixi
/usr/local/bin/pixi: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=31448c7de10dc4da60ce8e7fcabcd73ddfbd6c41, stripped
root@7756ce0dc1a3:/# ldd /usr/local/bin/pixi
statically linked
as an even more fun exercise, let's try what happens when we copy the "statically linked" binary from the glibc base image to an alpine one?
FROM ghcr.io/prefix-dev/pixi:0.44.0 AS base
FROM alpine
COPY --from=base /usr/local/bin/pixi /usr/local/bin/pixi
RUN apk update && apk add file
docker run -it --rm $(docker build -t test --no-cache --quiet .)
/ # ldd /usr/local/bin/pixi
/lib/ld-musl-x86_64.so.1 (0x7a8c29a0d000)
/ # file /usr/local/bin/pixi
/usr/local/bin/pixi: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), static-pie linked, BuildID[sha1]=31448c7de10dc4da60ce8e7fcabcd73ddfbd6c41, stripped
/ # which pixi
/usr/local/bin/pixi
/ # ldd pixi
/lib/ld-musl-x86_64.so.1: cannot load pixi: No such file or directory
/ # file pixi
pixi: cannot open `pixi' (No such file or directory)
/ # pixi info
System
------------
Pixi version: 0.44.0
Platform: linux-64
Virtual packages: __unix=0=0
: __linux=6.13.8=0
: __archspec=1=zen3
Cache dir: /root/.cache/rattler/cache
Auth storage: /root/.rattler/credentials.json
Config locations: No config files found
Global
------------
Bin dir: /root/.pixi/bin
Environment dir: /root/.pixi/envs
Manifest dir: /root/.pixi/manifests/pixi-global.toml
/ # pixi exec python
Error: x failed to run activation
`-> No such file or directory (os error 2)
So, the same as what happened when we installed the muslc linked binary from the Github Releases in the first step, except that here we took a "statically linked" binary from the glibc based Ubuntu (from the second test) and when copied into an Alpine container, from that point on ldd says that it's linked against ld-musl.
This last thing may or may not be a "normal" thing for ldd on different libc-s.
Issue description
pixi does not run on Alpine with either the muslc release from github or by copying the "statically linked" binary from the ubuntu base image.
Expected behavior
Pixi should work normally inside alpine
Thanks for the report @vidosits. The error message isn't exactly the same, but your problem is probably related to https://github.com/prefix-dev/pixi/issues/2694
Will put this issue on our todo list!
Thank you! Yes, I have met that message as well, but I couldn't reliable reproduce it, only the one I've shown here.
Just out of curiosity, is there something going on with how the pixi binary is linked? I'm not sure how/why ldd sees different linkage (statically vs dynamically) in the presence/absence of different libc implementations?
Just out of curiosity, is there something going on with how the pixi binary is linked? I'm not sure how/why ldd sees different linkage (statically vs dynamically) in the presence/absence of different libc implementations?
To be honest, without further investigation, this is also pretty mysterious to me. Definitely something we should tackle!
with CONDA_OVERRIDE_GLIBC=2.17 on alpine, pixi now can resolve the package. But if glibc is not really installed, pixi still can not run activation, and the installed binaries cannot be executed normally.