Skip to content

install: Reject a config stateroot on composefs-only images - #2567

Open
andrewdunndev wants to merge 1 commit into
bootc-dev:mainfrom
andrewdunndev:fix/composefs-config-stateroot
Open

andrewdunndev wants to merge 1 commit into
bootc-dev:mainfrom
andrewdunndev:fix/composefs-config-stateroot

Conversation

@andrewdunndev

Copy link
Copy Markdown
Contributor

The composefs backend only uses the default stateroot. #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.

This checks 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.

flowchart TD
    A["prepare_install loads the install configuration<br/>stateroot = myroot"] --> B{"composefs_required (UKI) or<br/>defaults_to_composefs_backend?"}
    B -- no --> C["config_stateroot is None<br/>kept for ostree installs"]
    B -- yes --> D{"--stateroot passed?"}
    D -- yes --> E["Only the --stateroot check applies"]
    D -- no --> F["InstallComposefsOpts::validate fails<br/>stateroot myroot in the install configuration<br/>is not supported with the composefs backend,<br/>which only uses default"]
Loading

Testing: test_composefs_opts_validate gets install configuration cases. On a Fedora 44 VM, with this change on #2544's branch, bootc install to-disk of an image that selects composefs and sets stateroot = "myroot" exited 1 with the new error and left no partition table, and with --stateroot default it installed into state/os/default. An ostree-capable image with the same configuration installed as before on both backends. An image with a UKI wasn't tested.

Assisted-by: AI

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>
@github-actions github-actions Bot added the area/install Issues related to `bootc install` label Oct 12, 2026
@bootc-bot
bootc-bot Bot requested a review from jeckersb October 12, 2026 14:21
Comment thread crates/lib/src/install.rs
"--stateroot {stateroot} is not supported with the composefs backend, which only uses {default}"
);
}
if let (None, Some(stateroot)) = (stateroot, config_stateroot.filter(|&s| s != default))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be simplified to

Suggested change
if let (None, Some(stateroot)) = (stateroot, config_stateroot.filter(|&s| s != default))
if let Some(stateroot) = config_stateroot.filter(|&s| s != default)

since we're already checking stateroot in the above if?

This branch has not been deployed

No deployments
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.

2 participants