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/timesyncd: run migration even if stateVersion is unset #66982

Closed
wants to merge 1 commit into from

Conversation

matthewbauer
Copy link
Member

This migration is needed on most systems that previously had pre-19.09
installed. We have any easy check for it in ‘[ -L
/var/lib/systemd/timesync ]’ that avoid duplicate migrations. We
should run it for unset stateVersion configurations too.

Fixes #64922

Motivation for this change
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.
Notify maintainers

cc @

This migration is needed on most systems that previously had pre-19.09
installed. We have any easy check for it in ‘[ -L
/var/lib/systemd/timesync ]’ that avoid duplicate migrations. We
should run it for unset stateVersion configurations too.

Fixes NixOS#64922
@@ -40,7 +40,7 @@ with lib;
users.users.systemd-timesync.uid = config.ids.uids.systemd-timesync;
users.groups.systemd-timesync.gid = config.ids.gids.systemd-timesync;

system.activationScripts.systemd-timesyncd-migration = mkIf (versionOlder config.system.stateVersion "19.09") ''
system.activationScripts.systemd-timesyncd-migration = mkIf ((versionOlder config.system.stateVersion "19.09") || !(config.system ? stateVersion)) ''
Copy link
Member

Choose a reason for hiding this comment

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

This can't work, stateVersion is always set because it has a default, and even if it wouldn't be always set config.system ? stateVersion would still always be true.

@infinisil
Copy link
Member

infinisil commented Aug 19, 2019

I think the real solution might be to change the condition to something like mkIf (lib.versionAtLeast "242" config.systemd.package.version), which should allow rollbacks too

This way people don't need to set stateVersion at all

@matthewbauer
Copy link
Member Author

Yeah, that would be nice, but I'm not sure if it would work either. config.systemd.package.version will be 242 in all NixOS 19.09, so the check is only useful if you run it before upgrading. I think the solution is backporting the systemd patch.

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.

systemd-timesyncd fails at step STATE_DIRECTORY on semi-clean install
2 participants