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

Race condition between systemd-binfmt and systemd-tmpfiles when using boot.binfmt #295365

Closed
arianvp opened this issue Mar 12, 2024 · 0 comments · Fixed by #295370
Closed

Race condition between systemd-binfmt and systemd-tmpfiles when using boot.binfmt #295365

arianvp opened this issue Mar 12, 2024 · 0 comments · Fixed by #295370
Labels
0.kind: bug Something is broken

Comments

@arianvp
Copy link
Member

arianvp commented Mar 12, 2024

Describe the bug

This bug was introduced in #263203

Before the folder /run/binfmt would be populated before systemd even runs (in an activation script).
Now it seems systemd-tmpfiles and systemd-binfmt are running in parallel. Hence a race condition is occurring.
Sometimes this works. Sometimes it doesn't.

Steps To Reproduce

Reboot often and it will complain /run/binfmt doesn't exist every once and a while

Mar 12 17:58:59 utm systemd-binfmt[604]: /etc/binfmt.d/nixos.conf:1: Failed to add binary format 'rosetta': No such file or directory
Mar 12 17:58:59 utm systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Mar 12 17:58:59 utm systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Mar 12 17:58:59 utm systemd[1]: Failed to start Set Up Additional Binary Formats.

Expected behavior

/run/binfmt is created before systemd-binfmt is started

I expect that we can perhaps fix this with a:

systemd.services.systemd-binfmt.after = [ "systemd-tmpfiles-setup.service" ];

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@nikstur

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a 👍 reaction to issues you find important.

@arianvp arianvp added the 0.kind: bug Something is broken label Mar 12, 2024
arianvp added a commit to arianvp/nixpkgs that referenced this issue Mar 12, 2024
…-binfmt

We need to make sure systemd-tmpfiles-setup.service ran before we
start systemd-binft.service. Otherwise it might fail to start
due to non-existant files

Fixes NixOS#295365
github-actions bot pushed a commit that referenced this issue Mar 13, 2024
…-binfmt

We need to make sure systemd-tmpfiles-setup.service ran before we
start systemd-binft.service. Otherwise it might fail to start
due to non-existant files

Fixes #295365

(cherry picked from commit 16526f4)
bjornfor pushed a commit that referenced this issue Mar 13, 2024
…-binfmt

We need to make sure systemd-tmpfiles-setup.service ran before we
start systemd-binft.service. Otherwise it might fail to start
due to non-existant files

Fixes #295365

(cherry picked from commit 16526f4)
@JohnRTitor JohnRTitor moved this to Done in systemd Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant