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

system.autoUpgrade: optionally allow rebooting the system on kernel change #64267

Merged
merged 2 commits into from Jul 12, 2019

Conversation

Projects
None yet
3 participants
@tokudan
Copy link
Contributor

commented Jul 3, 2019

Motivation for this change

new function for the module: Allows automatic reboots if the new generation uses a different kernel.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@tokudan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2019

The option has a description, so it should show up.
Default is false for allowReboot, so it should yield the same result as the current version, unless the allowReboot is enabled.
I don't think there's any test that can actually test an upgrade. I've ran it on nixos-19.03 channel and it does what it's supposed to, i.e. build the new generation, check if the kernel has changed. If the kernel is the same, it runs a switch. If the kernel has changed, it will boot into the new generation.

@tokudan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2019

not sure who's the best to mention here, but probably @edolstra as the first and @danbst as the last contributor for that file?

@bachp

This comment has been minimized.

Copy link
Contributor

commented Jul 4, 2019

I tried something similar but I took a different approach.

I always did a switch and then checked if the kernel has changed, if so I did a reboot.

I'm not sure if this has some drawbacks compared to your version, but it for sure has less cases as it is just a post step after the normal switch.

@danbst

danbst approved these changes Jul 4, 2019

Copy link
Contributor

left a comment

Overall looks good! Left a few style comments.

I'd like also to see a test for this, though I understand it isn't easy to write one.

Show resolved Hide resolved nixos/modules/tasks/auto-upgrade.nix Outdated
Show resolved Hide resolved nixos/modules/tasks/auto-upgrade.nix Outdated
Show resolved Hide resolved nixos/modules/tasks/auto-upgrade.nix Outdated
@tokudan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 5, 2019

I'd love to have a test for this as well, but I have no idea where to start writing one, so I'll leave that open.
I'm testing this on my system right now, so please don't merge yet until I've verified it's working.
Just need the stable channel to have a kernel update.

@tokudan tokudan changed the title system.autoUpgrade: optionally allow rebooting the system on kernel change [WIP] system.autoUpgrade: optionally allow rebooting the system on kernel change Jul 5, 2019

@tokudan

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2019

So there was kernel update recently and the module worked just fine when hammered into 19.03, so I believe the PR is ready to be merged if there are no objections?

@tokudan tokudan changed the title [WIP] system.autoUpgrade: optionally allow rebooting the system on kernel change system.autoUpgrade: optionally allow rebooting the system on kernel change Jul 11, 2019

@danbst

danbst approved these changes Jul 12, 2019

@danbst danbst merged commit ed86bba into NixOS:master Jul 12, 2019

12 checks passed

Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.