Skip to content

install: Reject --stateroot with the composefs backend - #2544

Merged
jeckersb merged 1 commit into
bootc-dev:mainfrom
andrewdunndev:fix/composefs-reject-stateroot
Oct 6, 2026
Merged

jeckersb merged 1 commit into
bootc-dev:mainfrom
andrewdunndev:fix/composefs-reject-stateroot

Conversation

@andrewdunndev

Copy link
Copy Markdown
Contributor

bootc install to-disk --composefs-backend --stateroot myroot now fails with error: Installing to disk: --stateroot myroot is not supported with the composefs backend, which only uses default. Before this, it exited 0 and installed into state/os/default.

The check sits in InstallComposefsOpts::validate beside the --bootloader=none one and runs from prepare_install, so it covers to-disk, to-filesystem and to-existing-root. --stateroot default is still accepted, since composefs uses that name. A stateroot set in the install config TOML isn't checked, since an image may set one for its ostree installs.

Testing: make validate passes, and cargo test -p bootc-lib reports 286 passed and 1 ignored. test_composefs_opts_validate gets stateroot cases, which fail with the check removed or with default no longer exempted. In a VM, bootc install to-disk with --stateroot myroot exited 1 and left no partition table, both with --composefs-backend and on an image that selects composefs itself. Composefs with --stateroot default or no flag installed into state/os/default, and ostree with --stateroot myroot into ostree/deploy/myroot.

The VM installs were run by hand; there's no new tmt test. Composefs installs from the just build images fail with Invalid splitstream content type even without --stateroot, so those installs used the image squashed to one layer.

Closes: #2542

The composefs backend has a single stateroot: the shared /var lives
at state/os/default/var and nothing in its install path reads the
stateroot name. So `--stateroot myroot` together with
`--composefs-backend` (or with an image that selects that backend
itself) exited successfully and installed into `default` anyway.

Fail early in InstallComposefsOpts::validate instead, the same way
`--bootloader=none` is rejected. This covers to-disk, to-filesystem
and to-existing-root, which all go through prepare_install. Passing
`--stateroot default` names what the backend uses and stays
accepted.

Closes: bootc-dev#2542

Assisted-by: AI
Signed-off-by: Andrew Dunn <andrew@dunn.dev>
@github-actions github-actions Bot added the area/install Issues related to `bootc install` label Oct 5, 2026
@bootc-bot
bootc-bot Bot requested a review from jeckersb October 5, 2026 14:13

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right thing to do now, though we do want to support this in the future

@jeckersb
jeckersb merged commit 33b1307 into bootc-dev:main Oct 6, 2026
91 of 96 checks passed
andrewdunndev added a commit to andrewdunndev/bootc that referenced this pull request Oct 19, 2026
The composefs backend only uses the `default` stateroot. bootc-dev#2544 made
`--stateroot` fail with it and left a stateroot from the install
configuration unchecked, since an image may set one for its ostree
installs. An image that ships a UKI, or selects composefs itself with
no ostree prepare-root.conf, can't be installed with ostree, so its
configured stateroot was always ignored and the install still landed
in `default`.

Check the configured stateroot for those images too, unless
`--stateroot` is passed. With `--composefs-backend` on an image that
can also be installed with ostree, it's still ignored.

Assisted-by: AI
Signed-off-by: Andrew Dunn <andrew@dunn.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install: --stateroot is silently ignored with --composefs-backend

3 participants