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

persisting /etc/machine-id does not work #6

Closed
WilliButz opened this issue Oct 28, 2024 · 1 comment
Closed

persisting /etc/machine-id does not work #6

WilliButz opened this issue Oct 28, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@WilliButz
Copy link
Member

WilliButz commented Oct 28, 2024

In case someone runs into this issue:

With recent upstream NixOS changes the handling of /etc/machine-id changed.
Currently another change is necessary upstream, i.e. the file needs to be created with content uninitialized\n and on a setup with preservation something like the following needs to be done to properly preserve the machine-id across reboots. I'm not yet sure how to handle the necessary config change for the commit service.

{
  preservation.preserveAt."/state".files = [
    { file = "/etc/machine-id"; inInitrd = true; how = "symlink"; }
  ];

  systemd.services.systemd-machine-id-commit = {
    unitConfig.ConditionPathIsMountPoint = [
      "" "/state/etc/machine-id"
    ];
    serviceConfig.ExecStart = [
      "" "systemd-machine-id-setup --commit --root /state"
    ];
  };
}

Note that it is no longer possible to use the default behavior (i.e. how == "bindmount") to preserve machine-id, using a symlink instead works.
See NixOS/nixpkgs#351151 (comment)

@WilliButz WilliButz added the bug Something isn't working label Oct 28, 2024
@WilliButz
Copy link
Member Author

Documented and tested in 2788945 and b8f8a13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant