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

nixos-rebuild: Ask for admin privileges #55802

Open
AMDphreak opened this issue Feb 15, 2019 · 12 comments
Open

nixos-rebuild: Ask for admin privileges #55802

AMDphreak opened this issue Feb 15, 2019 · 12 comments

Comments

@AMDphreak
Copy link

AMDphreak commented Feb 15, 2019

Issue description

nixos-rebuild should ask for elevated privileges.

citing this: VSCode does not build (declarative installation) #55790

Additionally, it appears that you've used nixos-rebuild without sudo which is probably why you got the permission error.

@matthewbauer
Copy link
Member

I think only nixos-rebuild switch needs root priveleges.

@vcunat
Copy link
Member

vcunat commented Feb 17, 2019

Right, I commonly build my system without root privileges with nixos-rebuild build, and then I use boot or switch with sudo. Adding --upgrade would also require sudo.

@AMDphreak
Copy link
Author

I think only nixos-rebuild switch needs root priveleges.

Good catch. I wasn't aware. I've been doing all commands as root.

@aaronjanse
Copy link
Member

Prompting the user for the sudo password at the beginning can save time. Think of how installing Windows would (at least used) take a while due to blocking dialogs showing up while the user is off doing another task (since the install takes a while).

On the other hand, the user may want to run as superuser only what's necessary, for security reasons. I don't know if this is a legitimate concern once the entire the nixos-rebuild process is taken into account.

@aaronjanse
Copy link
Member

@AMDphreak
Copy link
Author

@aaronjanse It does so much more. Requesting root is an essential user experience change. Linux land is filled with unhelpful error messages. This habit has to be fixed.

@domenkozar
Copy link
Member

@domenkozar
Copy link
Member

Seems like the consensus is to improve the error message based on #57333 (comment)

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@bobvanderlinden
Copy link
Member

bobvanderlinden commented Feb 9, 2023

It seems there is a conscious decision to not automatically run sudo, but make it explicit.

It is possible to run sudo automatically when using --use-remote-sudo:

$ nixos-rebuild --use-remote-sudo boot

Should the user be informed about this option when they run into permission errors?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Feb 9, 2023
@con-f-use
Copy link
Contributor

The problem with that nixos-rebuild --use-remote-sudo is broken (see #118655)

@rgri
Copy link
Contributor

rgri commented Nov 19, 2023

Curious if there are any favourite workarounds people are using for this. I suppose I will just end up using a deployment tool, but my scale is reallly small, so if I could deploy using just nixos-rebuild I'd be very happy with that.

@samueldr samueldr changed the title Make nixos-rebuild ask for admin privileges nixos-rebuild: Ask for admin privileges Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants