-
Notifications
You must be signed in to change notification settings - Fork 331
remove $stateroot/var rw bind mount / improve do_remount() #3525
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
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
542e525
to
09ba26c
Compare
Blocked by coreos/fedora-coreos-config#3773 |
Would be good to sanity-check el9-based SCOS before merging this. |
Ignition stopped using it in 2019 (coreos/ignition@852008f), and it has been broken for 2 years (ostreedev@64afbcd) (mkdirat(/run/ostree) fails if /run/ostree already exists)
a489241
to
12133f1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Done, it boots fine
|
Recent versions of mount that use the new mount API (util-linux 2.39) will honor the 'bind,rw' mount option and create a writable bind mount even if the source is read-only. For older mount versions, install a simple mount helper that create the bind mount then remount bind,rw it. This avoids having /var read-only before ostree-remount runs.
Now that we have mount.ostreebindrw helper, we can safely remove the $stateroot/var rw bind mount. This allow to have /sysroot fully read-only.
When we remount read only, we only want to change the vfs read only flag, not the fs one, so use MS_BIND. On the contrary when we remount read write, we want to change both (already ok). To check that we are allowed to write, we now use 'access'. We should never need do_remount(), as everything should have been properly setup by prepare-root and ostree-system-generator, so start to warn() when we actually remounted something.
12133f1
to
5070049
Compare
I've now added a small mount helper so var.mount is writable right away. |
AC_DEFINE([BUILDOPT_LIBSYSTEMD_AND_LIBMOUNT], 1, [Define if systemd and libmount])) | ||
if test x$with_libsystemd = xyes; then OSTREE_FEATURES="$OSTREE_FEATURES systemd"; fi | ||
|
||
AC_ARG_WITH(mounthelper, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work on this!
I am really not excited about the idea of installing a globally accessible binary just to expose Type=ostreebindrw
with .mount
units.
I think instead couldn't we generate a .mount
unit with a Requires+After
on a .service
which did a pre-mount or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've played a bit more with this, if we mount something at /var
before var.mount
then var.mount
will be enabled but it'll not run, and most importantly it'll print a confusing message (/var was skipped because of an unmet condition check (ConditionKernelCommandLine=!systemd.volatile).
)
We can't use mount move without changing the mount propagation (moving a mount residing under a shared mount is unsupported.
), so we could make /sysroot
private, but this might have side effects.
Last solution is to have a first .service
that prepare a temp bind mount already rw
(at $stateroot/var
), have var.mount
bind that, then have a second .service
to cleanup the temporary bind mount
Adding mount.ostreebindrw
would only impact EL9 and is way simpler / cleaner than 2 extra .service
IMO
@cgwalters what do you prefer ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another solution is also to keep thing as is for distro with old mount (EL9)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well...yes, we could probably have a rhel9 branch here.
I guess bigger picture from my PoV we're trying really hard to work on the new bootc+composefs backend, and I'm hesitant on the risk/reward of further deeper changes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for a separate rhel9 branch, just a configure option
Will send the first cleanup commit in a separate PR and rework this one to remove the mount just for recent system, the changes should be smaller.
Will the new backend be usable with rpm-ostree ?
Note: This requires a small change on CoreOS side: coreos/fedora-coreos-config#3773
Fixes #3519