diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 5ad8cdbcb18..c1ca0ca4ca7 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -608,5 +608,14 @@ in users.extraGroups.systemd-journal.gid = config.ids.gids.systemd-journal; + # FIXME: This should no longer be needed with systemd >= 204. + systemd.services."systemd-update-utmp-reboot.service" = + { description = "Update UTMP about System Reboot"; + wantedBy = [ "sysinit.target" ]; + unitConfig.DefaultDependencies = false; + serviceConfig.Type = "oneshot"; + serviceConfig.ExecStart = "${systemd}/lib/systemd/systemd-update-utmp reboot"; + }; + }; } diff --git a/tests/misc.nix b/tests/misc.nix index 41bd2a8686d..47775ce2a1e 100644 --- a/tests/misc.nix +++ b/tests/misc.nix @@ -47,6 +47,11 @@ subtest "blkio-cgroup", sub { $machine->succeed("[ -n \"\$(cat /sys/fs/cgroup/blkio/blkio.sectors)\" ]") }; + + # Test whether we have a reboot record in wtmp. + subtest "reboot-wtmp", sub { + $machine->succeed("last | grep reboot >&2"); + }; ''; }