Skip to content

Commit

Permalink
root|modules: update flake.lock, fix systemd messing with machine-id …
Browse files Browse the repository at this point in the history
…early

In the newest release of systemd (or the _newer_ release compared to the previous nixpkgs revision), a new `systemd-machine-id-commit.service` was introduced to help ensure `/etc/machine-id` was correctly saved from a transient fs like `tmpfs` to a real persistent device. This is for fairly obvious reasons, systemd relies on the machine-id to store logs and other system stateful information, and losing it each time defuncts those data.

Unfortunately, whilst well intentioned this service does nothing for my use-case because we already handle this ourselves (ignoring the `nixos-install` issue which has yet to be fixed). As a result, we can simply disable this service since there is enough assurance it won't be needed. Checking `systemctl --failed` shows no other services failing due to this change, which gives me the confidence in knowing this service is non-essential to anything else, and can be safely disabled.
  • Loading branch information
Frontear committed Nov 15, 2024
1 parent 32e83e9 commit 8d77c1e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 20 deletions.
38 changes: 19 additions & 19 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion modules/common/persist/module-impl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ in {
mode = "700";
}];

# Ensure consistency with some systemd tools.
# machine-id is widely used by systemd to track system-specific
# things, very important to persist it for general expectations.
my.persist.files = [
"/etc/machine-id"
];

# Kill the systemd-machine-id-commit.service from systemd 256.7,
# it does what we already handle via the activation script.
systemd.services."systemd-machine-id-commit".enable = false;

system.activationScripts.persist = lib.stringAfter [ "users" "groups" ] ''
log() {
echo "[persist] $1"
Expand Down

0 comments on commit 8d77c1e

Please sign in to comment.