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

Merged change into nixpkgs causes problems with /etc/machine-id if it is a bind mount #229

Closed
kaldyr opened this issue Nov 1, 2024 · 4 comments

Comments

@kaldyr
Copy link

kaldyr commented Nov 1, 2024

The service systemd-machine-id-commit.service will now cause problems if /etc/machine-id is configured as a bind mount. It may work if it is a symlink.

On rebuild:

warning: the following units failed: systemd-machine-id-commit.service
× systemd-machine-id-commit.service - Save Transient machine-id to Disk
     Loaded: loaded (/etc/systemd/system/systemd-machine-id-commit.service; enabled; preset: ignored)
     Active: failed (Result: exit-code) since Thu 2024-10-31 17:08:10 PDT; 348ms ago
 Invocation: 376b00e9024546a58aead7f2f41f33d3
       Docs: man:systemd-machine-id-commit.service(8)
    Process: 15455 ExecStart=systemd-machine-id-setup --commit (code=exited, status=1/FAILURE)
   Main PID: 15455 (code=exited, status=1/FAILURE)
         IP: 0B in, 0B out
   Mem peak: 1.8M
        CPU: 8ms

Oct 31 17:08:10 mjolnir systemd[1]: Starting Save Transient machine-id to Disk...
Oct 31 17:08:10 mjolnir systemd-machine-id-setup[15455]: /etc/machine-id is not on a temporary file system.
Oct 31 17:08:10 mjolnir systemd[1]: systemd-machine-id-commit.service: Main process exited, code=exited, status=1/FAILURE
Oct 31 17:08:10 mjolnir systemd[1]: systemd-machine-id-commit.service: Failed with result 'exit-code'.
Oct 31 17:08:10 mjolnir systemd[1]: Failed to start Save Transient machine-id to Disk.
warning: error(s) occurred while switching to the new configuration

Merged PR: nixpkgs:351151

Some discussion there.

Temporary workaround:

boot.initrd.systemd.suppressedUnits = [ "systemd-machine-id-commit.service" ];
systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ];
@jrbp
Copy link

jrbp commented Nov 1, 2024

If using a symlink doesn't cause the issue could we do:

systemd.tmpfiles.rules =  [
  "L /etc/machine-id - - - - /persist/etc/machine-id"
]

Or is there an issue like tmpfiles being created at the wrong time at boot compared to when this service runs?

Is it possible to make files be symlinks with the nixos impermanence module? It seems the method option that directories have doesn't exist for files.

Enkaiyuegure added a commit to Enkaiyuegure/flakes that referenced this issue Nov 2, 2024
…ce trigger

The bind mount creation for `/etc/machine-id` by `impermanence` is unintentionally triggering `systemd-machine-id-commit.service`, causing an error.
This commit resolves this issue, see: nix-community/impermanence#229.
And NixOS/nixpkgs#351151 for details.
Enkaiyuegure added a commit to Enkaiyuegure/flakes that referenced this issue Nov 2, 2024
…emd-machine-id-commit.service

The bind mount creation for `/etc/machine-id` by `impermanence` is unintentionally triggering `systemd-machine-id-commit.service`, causing an error.
This commit resolves this issue, see: nix-community/impermanence#229
and NixOS/nixpkgs#351151 for details.
@willbush
Copy link
Contributor

willbush commented Nov 3, 2024

I briefly tried the symlink workaround, but something stomped on it (think when rebooting) and just created a new machine-id file.

willbush added a commit to willbush/system that referenced this issue Nov 4, 2024
Enkaiyuegure added a commit to Enkaiyuegure/flakes that referenced this issue Nov 4, 2024
…emd-machine-id-commit.service

The bind mount creation for `/etc/machine-id` by `impermanence` is unintentionally triggering `systemd-machine-id-commit.service`, causing an error.
This commit resolves this issue, see: nix-community/impermanence#229
and NixOS/nixpkgs#351151 for details.
timon-schelling added a commit to timon-schelling/timonos that referenced this issue Nov 4, 2024
evelynandrist added a commit to evelynandrist/nix-config that referenced this issue Nov 10, 2024
@talyz talyz closed this as completed in 3ed3f0e Nov 10, 2024
@kaldyr
Copy link
Author

kaldyr commented Nov 10, 2024

That was intended as a temporary workaround. Per the discussion: It will work on existing machines, but may cause problems with machines that are created for the first time. Will the /etc/machine-id file be generated without that service?

dixslyf added a commit to dixslyf/dotfiles that referenced this issue Dec 4, 2024
…ermanence#229"

This reverts commit 80373ea.

Fix is now in upstream impermanence.
@talyz
Copy link
Collaborator

talyz commented Dec 15, 2024

Please see #242 for a follow-up fix to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants