prepare-var: Do not remount stateroot var in-place, and unmount the temporary var mount after real /var is mounted #3363
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.
This is split out of some merge-ready commits in #3358.
Currently, in
ostree-prepare-root
, we create a read-writable bind-mount of/sysroot/ostree/deploy/$stateroot/var
in-place, and in a unit generated byostree-system-generator
, it is then bind-mounted to/var
. This approach causes some problem:/sysroot/ostree/deploy/$stateroot/var
.ostree-system-generator
to get the path to stateroot./sysroot/ostree/deploy/$stateroot/var
is not unmounted afterwards, polluting the global mount namespace.This PR tries to solving these problem by instead of bind-mounting var in-place, bind-monting it to
/run/ostree/.private/var
inostree-prepare-root
. In this way,ostree-system-generator
can bind-mount a fixed path to/var
, and the mount is not necessary to be made slave+shared. Also,ostree-system-generator
creates a serviceostree-unmount-temp-var.service
that unmounts the temporary mount of var after real /var is mounted.