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

sysupdate: Support volatile-root for finding the root partition #25242

Merged
merged 1 commit into from Nov 18, 2022

Conversation

reubeno
Copy link
Contributor

@reubeno reubeno commented Nov 2, 2022

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 what systemd-repart and gpt-auto-generator already do (references: #20612, #20578).

I tested this change by using mkosi to build an Ubuntu 22.04 image booted with systemd.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 / (unlike systemd-repart, which does) and it seemed prudent to preserve that behavior.

@poettering
Copy link
Member

looks conceptually OK. but please rework to just stat() the path stored in that file, to derive major/minor, see comments.

@poettering
Copy link
Member

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 / (unlike systemd-repart, which does) and it seemed prudent to preserve that behavior.

I guess that is obsolete: just use stat(), and then the codepaths will look totally different anyway.

@poettering poettering added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Nov 10, 2022
The existing logic can't find the root device in scenarios where
the root has been replaced with an overlay. We support looking
at "/run/systemd/volatile-root" to find the original root, similar
to what systemd-repart and gpt-auto-generator do.
@yuwata yuwata removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Nov 13, 2022
@poettering poettering merged commit f8a7112 into systemd:main Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

systemd-sysupdate can't find root device when systemd.volatile=overlay is used
3 participants