Repository navigation
Conversation
The post-install stages of bootc disk images (users, home directories, files, subscription and the final SELinux relabel) work on the ostree deployment. Its /var is a non-recursive bind mount of the stateroot var, so filesystems mounted at /var on the physical root stay hidden from these stages. For example, with a separate /var or /var/home logical volume, user home directories and SSH keys were written below the mountpoint on the root filesystem and were missing at boot. Mount the /var filesystems after the deployment mount and before the (recursive) bind mount to the tree, so customizations land on the filesystems that are mounted at boot. As setfiles does not descend into other mounts, also relabel each of them explicitly. Layouts without filesystems below /var produce the same manifests as before. Generated-by: AI
bootc can initialize filesystems mounted at /var or below in the target from the image's /var content, and advertises this as the `initialize-var-mounts` install feature in `bootc container inspect` (proposed separately in bootc). Without that, separate /var filesystems in a bootc disk image stay empty and hide the image's /var content at boot. Look up the feature in the container that runs the installation (the build container, if one is set) and only then mount /var filesystems for the install-to-filesystem stage. Otherwise the stage keeps mounting just /, /boot and /boot/efi: older bootc versions would leave the filesystems empty, and versions before 1.12 reject mountpoints in the target root. The `bootc container inspect` output is now parsed separately from running it, and run once per container. Related: bootc-dev/bootc#1615 Generated-by: AI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
bootc disk images with separate filesystems at
/varor below (for exampleLVM logical volumes for
/var,/var/logor/var/home, configured throughcustomizations.disk) currently boot with those filesystems missing content:/varcontent is seeded bybootc install to-filesysteminto the deployment's state directory on the root filesystem, and the
separately mounted filesystems hide it at boot. The install stage only
mounts
/,/bootand/boot/efi, so bootc never sees the/varfilesystems.
files, subscription) are written to the same hidden location: the ostree
deployment's
/varis a non-recursive bind mount of the stateroot var, so the/varfilesystems mounted on the physical root are not visible to thosestages. For example, a blueprint user with an SSH key has no home directory or
authorized_keysat boot when/var/homeis a separate volume.Reported in osbuild/bootc-image-builder#1222.
This PR has two commits:
post-install stages mount the
/varfilesystems after theorg.osbuild.ostree.deploymentmount and before the (recursive) bind mountto the tree, so customizations land on the filesystems that are mounted at
boot. Since
setfilesdoes not descend into other mounts, each of them isalso relabeled explicitly. This works with any bootc version.
can initialize filesystems mounted below the target's
/varfrom the imageand advertises this as the
initialize-var-mountsinstall feature inbootc container inspect(install: Initialize separately mounted /var filesystems from the image bootc-dev/bootc#2521). The feature is lookedup in the container that runs the installation (the build container, if one
is set), and only then are the
/varfilesystems mounted for theinstall-to-filesystem stage. Otherwise the stage keeps mounting just
/,/bootand/boot/efi: older bofilesystemsempty, and versions before 1.12 reject mountpoints in the target root, so
builds with older bootc behave ex
bootc container inspectoutput running it,and run once per container.
Layouts without filesystems below `/ts as before.
Testing
stage mounts with and without the om
bootc container inspect(includi), and thebuild container taking precedence.
main(fixed
--seed), both for a bootcand for stockbootc 1.16.10.
(a separate
/varwith nested LVsparate/var),booted under UEFI:
directory and SSH key are on the right volumes,
restorecon -nis clean,and no units fail.
/varmounts (asbefore), and the user's home dirn the
/varvolume.
Related: osbuild/bootc-image-builder#1222, bootc-dev/bootc#1615
DRAFT, no need for reviews yet. This is my first pass and I have limited knowledge of image-builder. Need to test this more.
This also depend on bootc-dev/bootc#2521 being polished and accepted.