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

failed to link 'share/terminfo/N/NCR260VT300WPP' #234

Closed
pavelzw opened this issue Jul 26, 2023 · 11 comments
Closed

failed to link 'share/terminfo/N/NCR260VT300WPP' #234

pavelzw opened this issue Jul 26, 2023 · 11 comments

Comments

@pavelzw
Copy link
Contributor

pavelzw commented Jul 26, 2023

I want to run a docker container with pixi installed and a custom directory mounted as $HOME. This is not possible at the moment.

Dockerfile.test

FROM ubuntu:latest

RUN apt update && apt install -y curl
RUN curl -Ls https://github.com/prefix-dev/pixi/releases/latest/download/pixi-x86_64-unknown-linux-musl -o /usr/local/bin/pixi
RUN chmod +x /usr/local/bin/pixi

Steps to reproduce (I used macOS with M1 Pro)

❯ docker buildx build --platform linux/amd64 -t testimage --file Dockerfile.test .
[...]
❯ docker run --rm -it -v /tmp/test/4:/home/user testimage /bin/bash
root@5518e12f61e6:/# export HOME=/home/user
root@5518e12f61e6:/# cd /tmp
root@5518e12f61e6:/tmp# mkdir test
root@5518e12f61e6:/tmp# cd test
root@5518e12f61e6:/tmp/test# pixi init
Initialized project in /tmp/test/.
root@5518e12f61e6:/tmp/test# pixi add python
Added python 3.11.4.*
root@5518e12f61e6:/tmp/test# pixi install -vvv
[...]
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
DEBUG rattler::install: failed to create hard link in target directory: Cross-device link (os error 18). Disabling use of hard links.
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
error: failed to link 'share/terminfo/N/NCR260VT300WPP'

Caused by:
    0: could not open source file
    1: I/O error (os error 5)
DEBUG validating{path=/home/user/.cache/rattler/cache/pkgs/openssl-3.1.1-hd590300_1}:Connection{peer=Client}: h2::codec::framed_read: received frame=Data { stream_id: StreamId(3) }
@baszalmstra
Copy link
Contributor

The log statement

DEBUG rattler::install: failed to create hard link in target directory: Cross-device link (os error 18). Disabling use of hard links.

indicates that rattler correctly discovered that hardlinks are not allowed.

The actual error seems to originate here:

https://github.com/mamba-org/rattler/blob/9973c760fa9b3c6895d320209e315a34731cde97/crates/rattler/src/install/link.rs#L222

Is readlink not allowed on a mounted docker volume?

@baszalmstra
Copy link
Contributor

It looks like that is indeed an issue: https://stackoverflow.com/a/40322275

I guess using a copy fallback is then the only way..

@tdejager
Copy link
Contributor

Confirmed that this also happens on my M1.

@baszalmstra
Copy link
Contributor

After some more digging we have to go back to the drawing board on this one. It has nothing to do with either hardlinks or softlinks. It appears the error happens when opening the file or memory mapping it. The IO error 5 likely indicates a permission denied error. I also cannot reproduce this in WSL. @ruben-arts will check under Linux.

@baszalmstra
Copy link
Contributor

I assume that since the cache is actually filled, reading and writing from the mounted volume does work. So this would indicate that the error occurs when memory mapping the file.

@tdejager
Copy link
Contributor

It works for me when I remove the --platform flag to build an apple silicon oci image. Somehow the error does not occur.

@baszalmstra
Copy link
Contributor

I created a PR for rattler to add some more error information. Hopefully that allows us to pinpoint the error a little better: mamba-org/rattler#273

@baszalmstra
Copy link
Contributor

After some more debugging, we figured out that the issue was that the specific package that failed (ncurses-6.4-h2e1726e_0) contains both the file ncr260vt300wpp and NCR260VT300WPP. Since the macOS filesystem is case insensitive (different from Linux) and is mounted in the docker container, both files cannot exist simultaneously.

This is a macOS-specific issue that only occurs when mounting a docker volume into a Linux-based docker container and installing packages that expect a case-sensitive filesystem. Because of this pixi (or rattler) will never be able to install such a package in this scenario correctly. So I'm closing this issue.

Thanks for the patience and help @pavelzw !

@pavelzw pavelzw changed the title Pixi fails when hard links cannot be created failed to link 'share/terminfo/N/NCR260VT300WPP' Mar 25, 2024
@sg-s
Copy link

sg-s commented Jul 3, 2024

@baszalmstra what was the resolution to this? i think i'm running into the exact same issue:

  • running a docker container with linux/amd64 on macOS (arm64)
  • see this: failed to link ncurses-6.5-h0425590_0.conda

i tried dropping the --platform arg but that didn't do anything

@baszalmstra
Copy link
Contributor

I think as long as both the cache and the pixi environment are not installed on mounted volumes (so on a case sensitive volume) it should work.

@sg-s
Copy link

sg-s commented Jul 4, 2024

yes, thank you, i was about to say this too. for future readers:

this fix is to make sure the mounted volume is case-sensitive. if you're on macOS, you need to make a new volume, and use that to mount into docker

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

Successfully merging a pull request may close this issue.

4 participants