Only try to chmod /nix/var/nix/profiles/per-user when necessary#12391
Merged
roberth merged 1 commit intoNixOS:masterfrom Feb 20, 2025
Merged
Only try to chmod /nix/var/nix/profiles/per-user when necessary#12391roberth merged 1 commit intoNixOS:masterfrom
roberth merged 1 commit intoNixOS:masterfrom
Conversation
edolstra
previously requested changes
Feb 4, 2025
206cb37 to
aedfb1a
Compare
edolstra
reviewed
Feb 4, 2025
edolstra
reviewed
Feb 4, 2025
340b65c to
11b42e9
Compare
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
11b42e9 to
dcbf4dc
Compare
Member
|
I would factor out a |
Member
Author
|
Can I push that over to someone else? I barely knew enough c++ to write this change and doing bigger refactors will probably be a shit show. |
Member
|
#10991 (comment) I know I was having some deja vu :) |
Member
Author
|
Overriding the nix version to a really old one fixed the issue for renovate (renovatebot/github-action#713 (comment)) so I think it should work after this but I couldn't e2e test it. |
roberth
approved these changes
Feb 20, 2025
addressed by author SuperSandro2000
This was referenced Feb 20, 2025
mergify bot
added a commit
that referenced
this pull request
Feb 20, 2025
…2391 Only try to chmod /nix/var/nix/profiles/per-user when necessary (backport #12391)
mergify bot
added a commit
that referenced
this pull request
Feb 20, 2025
…2391 Only try to chmod /nix/var/nix/profiles/per-user when necessary (backport #12391)
mergify bot
added a commit
that referenced
this pull request
Feb 20, 2025
…2391 Only try to chmod /nix/var/nix/profiles/per-user when necessary (backport #12391)
|
Many thanks @SuperSandro2000 and @roberth. I'll try to find time to test it with the next patch release of https://hub.docker.com/r/nixos/nix/tags. |
mkenigs
added a commit
to mkenigs/nix
that referenced
this pull request
Jun 9, 2025
Give some hints about what could be going wrong when Nix can't acquire the db lock. Currently running Nix as a non-root user on a single-user install prints the error: ``` error: opening lock file '/nix/var/nix/db/big-lock': Permission denied ``` The error was recently changed (NixOS#12391), but people have frequently run into the prior error: ``` error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted ``` There seems to be a lot of confusion about the prior error, and the current error doesn't seem to give much more of a hint about how to resolve the problem. Modify the error to provide some hints at what could be going wrong, instead erroring with: ``` error: don't have permission to lock Nix database in '/nix/var/nix/db'. This command may have been run as non-root in a single-user Nix installation, or the Nix daemon may have crashed. ```
mkenigs
added a commit
to mkenigs/nix
that referenced
this pull request
Jun 9, 2025
Give some hints about what could be going wrong when Nix can't acquire the db lock. Currently running Nix as a non-root user on a single-user install prints the error: ``` error: opening lock file '/nix/var/nix/db/big-lock': Permission denied ``` The error printed in this situation was indirectly changed recently by NixOS#12391, but people have frequently run into the prior error: ``` error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted ``` There seems to be a lot of confusion about the prior error, and the current error doesn't seem to give much more of a hint about how to resolve the problem. Modify the error to provide some hints at what could be going wrong, instead erroring with: ``` error: don't have permission to lock Nix database in '/nix/var/nix/db'. This command may have been run as non-root in a single-user Nix installation, or the Nix daemon may have crashed. ```
mkenigs
added a commit
to mkenigs/nix
that referenced
this pull request
Jun 10, 2025
Give some hints about what could be going wrong when Nix can't acquire the db lock. Currently running Nix as a non-root user on a single-user install prints the error: ``` error: opening lock file '/nix/var/nix/db/big-lock': Permission denied ``` The error printed in this situation was indirectly changed recently by NixOS#12391, but people have frequently run into the prior error: ``` error: could not set permissions on '/nix/var/nix/profiles/per-user' to 755: Operation not permitted ``` There seems to be a lot of confusion about the prior error, and the current error doesn't seem to give much more of a hint about how to resolve the problem. Modify the error to provide some hints at what could be going wrong, instead erroring with: ``` error: don't have permission to lock Nix database in '/nix/var/nix/db'. This command may have been run as non-root in a single-user Nix installation, or the Nix daemon may have crashed. ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Try to get the current version working in renovate.
Context
#8074
in short: nix always chmod's
/nix/var/nix/profiles/per-userwhen not using the daemon even if the permissions are already correct. By first checking if the chmod is necessary we can avoid requiring more permissions then necessary.The error before was:
and now is avoided if the permissons are already correct.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.