prepare-root: Add support for root.transient
authorColin Walters <walters@verbum.org>
Thu, 7 Dec 2023 15:21:05 +0000 (10:21 -0500)
committerColin Walters <walters@verbum.org>
Thu, 7 Dec 2023 18:31:42 +0000 (13:31 -0500)
commit8fbaebac586cfb59a5bd8213839940d16667bcb4
treee2eee8bd1cfb0ded0cc964edbeb1de8129995158
parent59cdd6119fa7083133d8d7fde109b53214b1bea2
prepare-root: Add support for root.transient

Closes: https://github.com/ostreedev/ostree/issues/3113
It'd greatly improve compatibility with things like RPMs that install
in `/opt` if we supported a full "original docker" style model where
`/` is a transient overlayfs.  We'd still keep our semantics for `/etc`
and `/var` by default, but e.g. we'd stop recommending
`/opt` :arrow_right: `/var/opt`, in this model,
so `/opt` would be on the overlayfs.

Note this all aligns with composefs, where we'd actually be making
`/` a *read-only* overlayfs by default; it'd be really nice of course
to *implement* this by just making the composefs overlayfs writable,
but I am not sure we can hard require composefs for this right now.

So this change adds support for `root.transient = true`
in `/usr/lib/ostree/prepare-root.conf`.

The major downside is that people could be surprised if files they
write to e.g. `/opt` don't persist across upgrades.  But, that's
already again how it works since Docker started.

Note as part of the implementation of this, we need to add a whole
new "backing" directory distinct from the deployment directories.

(Tangentially related to this, it's tempting to switch to always
 using a *read-only* overlay mount by default.
src/libostree/ostree-sysroot-cleanup.c
src/libostree/ostree-sysroot-deploy.c
src/libostree/ostree-sysroot-private.h
src/libostree/ostree-sysroot.c
src/libotcore/otcore.h
src/switchroot/ostree-prepare-root.c