Conversation
The test passed the EFI system partition's UUID as the boot mount spec, while /boot is a separate ext4 partition in its layout. Use the UUID of the boot partition, which is what the installed system needs to mount. This went unnoticed because the test does not boot the result. Generated-by: AI
A common setup places /var, or parts of it such as /var/log, on separate filesystems (for example LVM logical volumes) so that runaway writes cannot fill the root filesystem. With `install to-filesystem` these filesystems end up empty: the deployment backend seeds the image's /var into its own state directory (`ostree/deploy/<stateroot>/var`, or the composefs shared var), and at boot the separately mounted filesystems hide that content. On a fresh to-filesystem installation, discover filesystems mounted at the target's /var or below. Each empty top-level mount tree, including its nested mounts, is initialized from the seeded /var with `cp --archive`, then SELinux labeled and synced. A tree that already contains data is preserved as a whole, without merging. Alongside, host-root and existing-deployment installs are not affected, nor is `install to-disk`. Callers remain responsible for mounting these filesystems at boot. Note this changes behavior for callers that mount an empty /var filesystem and fill it themselves after installation: they now find the image's content there first. The seeded copy in the state directory is kept; on OSTree, emptying it would make the next deployment reseed it. Hardlinks cannot span filesystems, so trees with nested mounts are copied without preserving them. The roots of these filesystems are labeled unconditionally: without selinuxfs (e.g. in an osbuild buildroot), an inode with no label still reports the kernel's unlabeled context, which the regular relabel walk takes as already labeled. The separate /var TMT test now ships content in the image, adds a nested logical volume, and checks contents, ownership, symlinks and SELinux labels on the actual volumes. It no longer disables SELinux. Related: bootc-dev#1615 Related: bootc-dev#997 Generated-by: AI
Tools that prepare a target for `install to-filesystem`, such as disk image builders, need to know whether the bootc in an image initializes mounted /var filesystems before they mount them: older versions leave such filesystems empty, so they hide the image's /var content at boot, and versions before 1.12 reject mountpoints in the target entirely. Add an `install-features` list to `bootc container inspect` output, currently containing `initialize-var-mounts`. It describes the bootc binary rather than the image, but this is the command builders already run against the image. The human-readable output is unchanged. Generated-by: AI
| pub(crate) kernel: Option<crate::kernel::Kernel>, | ||
| /// Optional `bootc install` behaviors implemented by this bootc binary, | ||
| /// for tools that prepare a target for `install to-filesystem`. | ||
| pub(crate) install_features: Vec<&'static str>, |
There was a problem hiding this comment.
Mmmm I'd rather just have bootc --version output global features this came up in another PR should be straightforward
| prepared and mounted by an external tool or script. The root filesystem | ||
| is currently expected to be empty by default. | ||
|
|
||
| Mount filesystems for `/var` or its subdirectories beneath *ROOT_PATH* |
There was a problem hiding this comment.
That's a bit ugly if we create /var in the physical root here though it's not the end of the world.
This is a really complex topic...humm...I think it'd be cleaner to have a --var mount option probably?
Another thing that we should definitely do is honor DPS - if we find a partition on the target system that matches "Variable Data Partition" we use it by default?
Same idea behind the ESP - we should really encourage installer tools to setup the ESP which we then mount ourselves during to-filesystem instead of having them mount it.
Of course though there could be someone out there that was relying on doing something with repart.d or something at firstboot time and us finding the partition at install time now could break things...
I'd vote: Honor DPS by default, encourage people to use it, have a --var mount option where installers can set it up, and also have --var= empty string mean "don't auto-discover DPS /var" but use the default?
A common setup places
/var, or parts of it such as/var/log, on separatefilesystems (for example LVM logical volumes). With
bootc install to-filesystemthese filesystemscurrently end up empty: the deployment backend seeds the image's
/varinto itsown state directory (
ostree/deploy/<stateroot>/var, or the composefs sharedvar), and at boot the separately mounted filesystems hide that content. Since
#1727 such mountpoints are accepted, but anything the image ships below them is
lost. This was reported in osbuild/bootc-image-builder#1222, where the
maintainers traced it to
bootc install to-filesystem; Anaconda calls it thesame way, so this should apply there too (untested).
This series:
existing test passed the ESP's UUID as
--boot-mount-spec. Independent fix.to-filesysteminstall, discover filesystems mounted at the target's/varor below, and initialize each empty top-level mount tree (including nested
mounts) from the seeded
/varwithcp --archive, then SELinux label andsync them.
install to-disk,are unchanged.
/varTMT test now ships content in the image, adds a nestedLV, checks contents, ownership,on the actual
volumes, and no longer passes `
container inspect: adds`"install-features": ["initialize prepare the
target (e.g. disk image builders)s for a bootc
that initializes them. Older versrsions before
1.12 reject them.
Behavior change
Callers that mount an empty
/varelves afterinstallation now find the image's coo opt-out; I'm
happy to add a flag if preferred.
Design notes and open questions
(
--var-mount-spec). This uses thr the targetinstead, which works unchanged for existing callers and handles nested mounts.
An explicit flag could be layered
an emptied stateroot
varis reseThe cost is thatthe initial
/varcontent is duplicated on the root filesystem.with
--no-preserve=links.in the image. A symlinked path is llowed.
in an osbuild buildroot), an unlabkernel's
unlabeled context, which the existing relabel walk treats as labeled.
install-featuresdescribes the image.container inspectwas chosen because builders already run it against theimage; `bootc install print-configive.
Testing
install::var_mountsh real nested mounts (#[ignore], run underuntest-install-to-filesystem-var-moVM: fails with bootc 1.16.10 (seed content missins series. It also passes with--composefs-backend` (install only, not booted).VMDK images with LVM layouts (a separate
/varwith nested LVs, and nestedLVs without a separate
/var), bonership andrestorecon -nwere verified at f; the rebased branch passes unit tests, e-generated --check.Related: #1615, #997, #336, osbuild/bootc-image-builder#1222
See also #1728; this automates the mere.
Generated-by: AI
DRAFT, no need for reviews yet. This is my first pass.
Once this is polished it pairs with: osbuild/image-builder#2733