Skip to content

Conversation

cgwalters
Copy link
Member

I've seen in some cases systemd try to unmount /etc quite early and then fail because it's in use.

It's confusing because I don't see this in all scenarios. But regardless, in the situations where it does occur, this fixes it.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds /etc and /var to the RequiresMountsFor= directive in the ostree-finalize-staged.service systemd unit. This change correctly ensures that these filesystems remain mounted during shutdown while the staged deployment is being finalized, preventing a race condition where systemd might unmount them prematurely. The change is sound and addresses the issue described. I have no further recommendations.

I've seen in some cases systemd try to unmount /etc quite early
and then fail because it's in use.

It's confusing because I don't see this in all scenarios.
But regardless, in the situations where it does occur,
this fixes it.

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters enabled auto-merge August 27, 2025 16:05
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@champtar
Copy link
Collaborator

champtar commented Aug 27, 2025

We are After=local-fs.target, so really makes no sense to me that we need RequiresMountsFor, it would make sense for automount, but not for /etc
Do you have logs / screenshot showing /etc unmount starting before ostree-finalize-staged.service is finished ?

@champtar
Copy link
Collaborator

Actually local-fs.target has After=sysroot.mount but not After=etc.mount

@champtar champtar disabled auto-merge August 27, 2025 16:45
@champtar
Copy link
Collaborator

(disabling auto-merge I just want to check few more things)

@champtar champtar enabled auto-merge August 27, 2025 17:18
Copy link
Collaborator

@champtar champtar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do require /etc to copy the changed files anyway, so it documents the requirement, but this is not a full fix IMO, we still need local-fs.target to be after etc.mount

@cgwalters
Copy link
Member Author

Actually local-fs.target has After=sysroot.mount but not After=etc.mount

Huh...I actually don't see that After=sysroot.mount ordering on this system (Fedora silverblue with LUKS). I do see it all other scenarios.

So indeed, that seems like perhaps a root problem.

@champtar champtar merged commit a5a52e0 into ostreedev:main Aug 27, 2025
26 checks passed
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

Successfully merging this pull request may close these issues.

3 participants