This repository was archived by the owner on Mar 25, 2025. It is now read-only.
Fixing "sudo: nix: command not found" when upgrading nix#6
Open
dnsem wants to merge 2 commits intoDeterminateSystems:mainfrom
Open
Fixing "sudo: nix: command not found" when upgrading nix#6dnsem wants to merge 2 commits intoDeterminateSystems:mainfrom
dnsem wants to merge 2 commits intoDeterminateSystems:mainfrom
Conversation
I installed nix 2.15 on Ubuntu 22.04 using DeterminateSystems installer. When trying to upgrade nix I got "sudo: nix: command not found". This workaround allowed me to successfully upgrade nix - it is using environment of normal user when running command as root user.
✅ Deploy Preview for flakehub-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
antoineco
reviewed
Jul 24, 2024
pages/faq.mdx
Outdated
|
|
||
| ```shell | ||
| sudo nix upgrade-nix \ | ||
| sudo -E env "PATH=$PATH" nix upgrade-nix \ |
Contributor
There was a problem hiding this comment.
This doesn't look right. -E preserves the entire environment, so there is no need to add env ... to the command.
Besides, it would be safer to preserve just the PATH variable instead of the entire environment, as a good practice:
Suggested change
| sudo -E env "PATH=$PATH" nix upgrade-nix \ | |
| sudo --preserve-env=PATH nix upgrade-nix \ |
Removed '-E' flag as running with modified PATH is enough
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
I installed nix 2.15 on Ubuntu 22.04 using DeterminateSystems installer. When trying to upgrade nix I got "sudo: nix: command not found". This workaround allowed me to successfully upgrade nix - it is using environment of normal user when running command as root user.