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

Could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted #777

Closed
mausch opened this issue Dec 11, 2023 · 4 comments

Comments

@mausch
Copy link
Contributor

mausch commented Dec 11, 2023

Given this dockerfile:

FROM codercom/code-server:4.18.0
RUN curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix/tag/v0.15.1 | sh -s -- install linux --init none --no-confirm
ENV PATH="$PATH:/nix/var/nix/profiles/default/bin"
$ docker build -t pp - < Dockerfile
$ docker run --rm -it --entrypoint /bin/bash pp
coder$ nix run nixpkgs#hello
error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted

Maybe related to #418

Also /nix/var/nix/profiles/per-user already has permission 755 , it seems the installer could check before attempting to change it?

The official installer works fine here:

        FROM codercom/code-server:4.18.0

        USER root
        RUN apt update && apt install -y xz-utils
        RUN mkdir -p /etc/nix
        RUN echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
        USER 1000

        RUN curl -L https://nixos.org/releases/nix/nix-2.19.1/install -o install-nix && chmod a+x install-nix && \
          ./install-nix --no-daemon --no-channel-add \
          && rm install-nix

        ENV HOME="/home/coder"
        ENV PATH="$PATH:$HOME/.nix-profile/bin:$HOME/.nix-profile/bin/nix"
@Hoverbear
Copy link
Contributor

This error is coming from Nix (not the installer) trying to change the permissions. The folder likely already has those permissions because the installer created them with those permissions.

You're runing the installer with --init none, so the caveats from https://github.com/DeterminateSystems/nix-installer#without-systemd-linux-only apply:

sudo -i nix run nixpkgs#hello

@tgunnoe
Copy link

tgunnoe commented Jan 19, 2024

is this the same story with macOS? I have the same error after installing the macOS version on an EC2 machine.

@mausch
Copy link
Contributor Author

mausch commented Aug 19, 2024

Hmm, I thought this installer should work wherever the official installer also worked?
It would be great if I could just use the DetSys installer everywhere without needing to fall back to the official installer in special cases.

@cole-h
Copy link
Member

cole-h commented Aug 20, 2024

Your mac woes sound very similar to #742. It might be worth it to peruse the discussion there.

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

No branches or pull requests

4 participants