diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2019-05-15 11:05:37 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2019-06-03 15:05:19 +0200 |
commit | 024a383d64036dab02157927369ca680427aa61d (patch) | |
tree | e35e7d5d64a44082cb6a2104585f6bb863ff576a /nixos/modules | |
parent | bc71b6eaf6ff9451cbbaa3e62aa200845d12f4e3 (diff) | |
download | nixlib-024a383d64036dab02157927369ca680427aa61d.tar nixlib-024a383d64036dab02157927369ca680427aa61d.tar.gz nixlib-024a383d64036dab02157927369ca680427aa61d.tar.bz2 nixlib-024a383d64036dab02157927369ca680427aa61d.tar.lz nixlib-024a383d64036dab02157927369ca680427aa61d.tar.xz nixlib-024a383d64036dab02157927369ca680427aa61d.tar.zst nixlib-024a383d64036dab02157927369ca680427aa61d.zip |
nixos/systemd: migrate systemd-timesync state when required
Somewhen between systemd v239 and v242 upstream decided to no longer run a few system services with `DyanmicUser=1` but failed to provide a migration path for all the state those services left behind. For the case of systemd-timesync the state has to be moved from /var/lib/private/systemd/timesync to /var/lib/systemd/timesync if /var/lib/systemd/timesync is currently a symlink. We only do this if the stateVersion is still below 19.09 to avoid starting to have an ever growing activation script for (then) ancient systemd migrations that are no longer required. See https://github.com/systemd/systemd/issues/12131 for details about the missing migration path and related discussion.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 2 | ||||
-rw-r--r-- | nixos/modules/system/boot/timesyncd.nix | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 18ee2ef1b8f5..8499b700d3ea 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -940,7 +940,6 @@ in # Don't bother with certain units in containers. systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container"; systemd.services.systemd-random-seed.unitConfig.ConditionVirtualization = "!container"; - }; # FIXME: Remove these eventually. @@ -949,5 +948,4 @@ in (mkRenamedOptionModule [ "boot" "systemd" "targets" ] [ "systemd" "targets" ]) (mkRenamedOptionModule [ "boot" "systemd" "services" ] [ "systemd" "services" ]) ]; - } diff --git a/nixos/modules/system/boot/timesyncd.nix b/nixos/modules/system/boot/timesyncd.nix index 8d8bfe5900a9..8282cdd6f3aa 100644 --- a/nixos/modules/system/boot/timesyncd.nix +++ b/nixos/modules/system/boot/timesyncd.nix @@ -40,6 +40,15 @@ 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") '' + # workaround an issue of systemd-timesyncd not starting due to upstream systemd reverting their dynamic users changes + # - https://github.com/NixOS/nixpkgs/pull/61321#issuecomment-492423742 + # - https://github.com/systemd/systemd/issues/12131 + if [ -L /var/lib/systemd/timesync ]; then + rm /var/lib/systemd/timesync + mv /var/lib/private/systemd/timesync /var/lib/systemd/timesync + fi + ''; }; } |