-
Notifications
You must be signed in to change notification settings - Fork 305
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
Extending read-only state to /sysroot and /boot #1265
Comments
See also for |
would this be an issue for system containers that use |
@giuseppe an important bit from the above is:
The goal here isn't to make things truly immutable, it's to prevent things like See also on-list discussion: https://mail.gnome.org/archives/ostree-list/2017-December/msg00009.html |
I see, thanks. Could the new API allow also the current mount namespace to be used? It will be the user responsibility to ensure a new mount namespace is created and |
PR in #1767 |
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Part of the implementation of ostreedev/ostree#1265 Convert to systemd mount units so we can easily specify the `ro` flag, and also to use the `LABEL={root,var}` rather than UUIDs. Enable the sysroot/readonly flag.
Requirements to implement this for Fedora CoreOS: |
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Yeah, we really should fix this. Right now, To anyone in that situation, you can recover from this by booting with
At this point, you should be able to boot in enforcing mode again. Final cleanup:
Note this will blow away all your layered packages; you'll have to relayer those again. |
should that be |
Thanks! I edited the original comment. |
For future reference I had to do an Other than that, this workaround is good! |
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`, which we can't mount readonly as we want `/etc` to be writable (and `/var` if it's there too). So we actually make it into a bind mount. Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Prep for using the default mount namespace handling there that will land as part of the read-only `/sysroot` and `/boot` work. See ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Prep for using the default mount namespace handling there that will land as part of the read-only `/sysroot` and `/boot` work. See ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Let's opt-in to this by default. See ostreedev/ostree#1265 This currently is a no-op if the required ostree support hasn't landed yet, so I think we can safely merge this PR first.
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. Or at least for `/boot` should *mostly* just be written by ostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
We want to support extending the read-only state to cover `/sysroot` and `/boot`, since conceptually all of the data there should only be written via libostree. Or at least for `/boot` should *mostly* just be written by ostree. This change needs to be opt-in though to avoid breaking anyone. Add a `sysroot/readonly` key to the repository config which instructs `ostree-remount.service` to ensure `/sysroot` is read-only. This requires a bit of a dance because `/sysroot` is actually the same filesystem as `/`; so we make `/etc` a writable bind mount in this case. We also need to handle `/var` in the "OSTree default" case of a bind mount; the systemd generator now looks at the writability state of `/sysroot` and uses that to determine whether it should have the `var.mount` unit happen before or after `ostree-remount.service.` Also add an API to instruct the libostree shared library that the caller has created a new mount namespace. This way we can freely remount read-write. This approach extends upon in a much better way previous work we did to support remounting `/boot` read-write. Closes: ostreedev#1265
Prep for using the default mount namespace handling there that will land as part of the read-only `/sysroot` and `/boot` work. See ostreedev#1265
Let's opt-in to this by default. See ostreedev/ostree#1265 This currently is a no-op if the required ostree support hasn't landed yet, so I think we can safely merge this PR first.
Let's opt-in to this by default. See ostreedev/ostree#1265 This currently is a no-op if the required ostree support hasn't landed yet, so I think we can safely merge this PR first.
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
Let's opt-in to this by default. See ostreedev/ostree#1265 This currently is a no-op if the required ostree support hasn't landed yet, so I think we can safely merge this PR first.
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
This is all we need to tell libostree that we support a read-only `/sysroot` and `/boot`. See ostreedev/ostree#1265 PR in ostreedev/ostree#1767
We want to use the new read-only `/sysroot` feature of libostree. Opt-in to that to tell cosa we support it and want it. For more details, see: ostreedev/ostree#1265 coreos/coreos-assembler#1235
We want to use the new read-only `/sysroot` feature of libostree. Opt-in to that to tell cosa we support it and want it. For more details, see: ostreedev/ostree#1265 coreos/coreos-assembler#1235
I still broke my Fedora Silverblue 31 system with |
OSTree knows how to handle read-only |
Thanks @jlebon. Could we dedicate a separate issue for that part of the task then? |
We want to use the new read-only `/sysroot` feature of libostree. Opt-in to that to tell cosa we support it and want it. For more details, see: ostreedev/ostree#1265 coreos/coreos-assembler#1235
We want to use the new read-only `/sysroot` feature of libostree. Opt-in to that to tell cosa we support it and want it. For more details, see: ostreedev/ostree#1265 coreos/coreos-assembler#1235
Today ostree has a ro bind mount over
/usr
, but one can just do e.g.rm -rf /sysroot/*
and the whole system is destroyed.Similarly, we tried to have support for
/boot
as a ro mount but it needs work.What we should do is have these be
ro
by default, and then have apps using libostree create a new mount namespace, and make manipulations there. That way the system stays read-only to everything else. Alternatively, we could teach libostree how to do that internally, but it'd get ugly fast...we'd need to fork off a subprocess basically.For example
rpm-ostreed
andeos-updater
could change their systemd unit files to create a new mount namespace, and tell libostree that one is set up.(Conceptually this overlaps a ton with systemd's
ProtectSystem=strict
...we're basically imposing that on the whole system by default)The text was updated successfully, but these errors were encountered: