sysupdate: Support volatile-root for finding the root partition #25242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The existing logic can't find the root device in scenarios where the root has been replaced with an overlay. This adds logic to look at
/run/systemd/volatile-root
to find the original root. This is similar to whatsystemd-repart
andgpt-auto-generator
already do (references: #20612, #20578).I tested this change by using
mkosi
to build an Ubuntu 22.04 image booted withsystemd.volatile=overlay
. Without this change,systemd-sysupdate
can't find the root device; with this change, it gets through the logic to find the root device and proceeds to query the transfer source.Fixes #25241
NOTE: My biggest question is whether it makes sense to minimally duplicate this logic as the PR presently does vs. extract out the
volatile-root
-checking logic in a utility function. I opted to go with the former as the logic in sysupdate intentionally looks at/usr
and not/
(unlikesystemd-repart
, which does) and it seemed prudent to preserve that behavior.