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

tokudan
Copy link
Contributor

@tokudan tokudan 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
Copy link
Contributor Author

tokudan 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
Copy link
Contributor Author

tokudan 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
Copy link
Member

bachp 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.

Copy link
Contributor

@danbst danbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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 Show resolved Hide resolved
@tokudan
Copy link
Contributor Author

tokudan 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
Copy link
Contributor Author

tokudan 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 merged commit ed86bba into NixOS:master Jul 12, 2019
tokudan added a commit to tokudan/nixpkgs that referenced this pull request Oct 12, 2019
(cherry picked from commit 8a2555132e0afeded544e90cc3990fab0c63093a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants