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: fix --install-bootloader #144429

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

anund
Copy link
Contributor

@anund anund commented Nov 3, 2021

nixos-rebuild relies on setting an environment variable to change
behaviour during nixos-rebuild boot/switch between calling update or
install via systemd bootctl. Adding sudo -- as a prefix to various exec
calls does not preserve the environment breaking this mechanism.

This is a some what ugly fix that works.

Motivation for this change
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • 21.11 Release Notes (or backporting 21.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS label Nov 3, 2021
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Nov 3, 2021
@anund
Copy link
Contributor Author

anund commented Nov 4, 2021

Fixes #144007

@anund anund force-pushed the nixos-rebuild-fix-install-bootloader branch from be4e2fd to 446e4cc Compare November 7, 2021 04:50
@anund
Copy link
Contributor Author

anund commented Nov 7, 2021

With #144422 merged to staging should this PR also be shifted to target staging? (how long until staging merges back into master?)

@Artturin
Copy link
Member

Artturin commented Nov 7, 2021

With #144422 merged to staging should this PR also be shifted to target staging?

does this pr depend on that? i dont think so since grub can use this too.

(how long until staging merges back into master?)

not sure

@anund
Copy link
Contributor Author

anund commented Nov 8, 2021

No dependencies. I'm curious to know if there's a ~simple way to track when fixed systemd + fixed install process would both be available on unstable. At the moment if you are broken and don't want to work with a custom checkout of nix you need both that change and this one to simplify the fix to nixos-rebuild --install-bootloader....

@Artturin
Copy link
Member

Artturin commented Nov 8, 2021

you can track the pr at https://nixpk.gs/pr-tracker.html?pr=144422

@anund anund force-pushed the nixos-rebuild-fix-install-bootloader branch from 446e4cc to ca36088 Compare November 9, 2021 09:48
@anund
Copy link
Contributor Author

anund commented Nov 16, 2021

@Artturin is there anything left to do but press merge?

@Artturin
Copy link
Member

Has anyone tested this? For example In a vm after removing the bootloader

@anund
Copy link
Contributor Author

anund commented Nov 17, 2021

Yes, I relied on this fix while testing changes for #144422. I went from non-functional boot loader and back again several times using this PR to verifying the updated systemd + patchset resulted in a working boot-loader.

nixos-rebuild relies on setting an environment variable to change
behaviour during nixos-rebuild boot/switch between calling update or
install via systemd bootctl. Adding sudo -- as a prefix to various exec
calls does not preserve the environment breaking this mechanism.

This is a some what ugly fix that works.

Closes NixOS#144429
@Artturin Artturin force-pushed the nixos-rebuild-fix-install-bootloader branch from ca36088 to bc5a610 Compare November 17, 2021 07:28
@Artturin Artturin changed the title nixos: fix nixos-rebuild --install-bootloader nixos-rebuild: fix --install-bootloader Nov 17, 2021
@Artturin Artturin merged commit add0eb8 into NixOS:master Nov 17, 2021
mkg20001 pushed a commit to mkg20001/nixpkgs that referenced this pull request Nov 18, 2021
nixos-rebuild relies on setting an environment variable to change
behaviour during nixos-rebuild boot/switch between calling update or
install via systemd bootctl. Adding sudo -- as a prefix to various exec
calls does not preserve the environment breaking this mechanism.

This is a some what ugly fix that works.

Closes NixOS#144429
@anund anund deleted the nixos-rebuild-fix-install-bootloader branch November 27, 2021 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants