Skip to content

install: Use systemd-repart for partitioning - #2314

Open
Johan-Liebert1 wants to merge 6 commits into
bootc-dev:mainfrom
Johan-Liebert1:systemd-repart
Open

install: Use systemd-repart for partitioning#2314
Johan-Liebert1 wants to merge 6 commits into
bootc-dev:mainfrom
Johan-Liebert1:systemd-repart

Conversation

@Johan-Liebert1

Copy link
Copy Markdown
Collaborator

If systemd-repart binary is present and we find one of the directories associated with systemd-repart configurations, then use systemd-repart for partitioning, else fallback to sfdisk

Also, update the default ESP size to 2G for composefs installs. This only applies to sfdisk path.

Closes: #2132

@github-actions github-actions Bot added the area/install Issues related to `bootc install` label Jul 14, 2026
@bootc-bot
bootc-bot Bot requested a review from gursewak1997 July 14, 2026 07:53
@Johan-Liebert1 Johan-Liebert1 added the ci/tier-1 Run CI for tier-1 OS (centos-10) only label Jul 14, 2026

@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.

Thanks for starting this! ACK on the principle.

Needs docs and tests at least.

Comment thread crates/lib/src/install/baseline.rs Outdated
}

let rootpn =
rootpn.ok_or_else(|| anyhow::anyhow!("systemd-repart output missing root partition"))?;

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.

I think we should support images that have repart.d definitions that are expected to run on firstboot in the target environment, without defining the default root either.

I would flip this around a bit - we default to running repart.d definitions for the root and esp/xbootldr, but probably not the other ones? And we let the other ones naturally run on firstboot.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think we should support images that have repart.d definitions that are expected to run on firstboot in the target environment, without defining the default root either.

so this will entail us creating a root partition if it's not defined?

Agree with the second point. We can only include root,esp and xbootldr

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Re-reading the comment, I think I get it now. The main question then would be how would be figure out the sizes of the root partition? Doing a simple --dry-run with systemd-repart is probably the best way

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.

The main question then would be how would be figure out the sizes of the root partition?

We honor the repart defaults i.e. something like

[Partition]
Type=root

should be all that's needed to have that fill the remaining space.

For cloud scenarios a common thing is that the raw block device is expanded dynamically, and I think there repart will run again and should handle expansion of the root.

@cgwalters cgwalters mentioned this pull request Jul 28, 2026
@Johan-Liebert1

Copy link
Copy Markdown
Collaborator Author

Currently we check fs-verity compatibility for composefs installations using the filesystem param passed via cli or in our config files. With systemd-repart, we will be allowing any filesystem to be used for root partition (not just the ones defined in our Filesystem enum).

This poses an issue with checking fs-verity compatibility of filesystems that are not defined in our enum. This is probably going to be a design choice, should we:

Read repart.d definitions, add more fs options in our enum to still be able to check for fs-verity compatibility
or
Simply ignore the check

cc @cgwalters @jeckersb

@cgwalters

Copy link
Copy Markdown
Collaborator

Currently we check fs-verity compatibility for composefs installations using the filesystem param passed via cli or in our config files. With systemd-repart, we will be allowing any filesystem to be used for root partition (not just the ones defined in our Filesystem enum).

I think ideally we do fsverity support detection early on dynamically instead of having a filesystem allowlist.

But I'd vote for now we just let the install fail if fsverity is required and we fail to enable it instead of trying to match filesystems via repart.d

@github-actions github-actions Bot added the area/documentation Updates to the documentation label Aug 4, 2026
If `systemd-repart` binary is present and we find one of the directories
associated with systemd-repart configurations, then use systemd-repart
for partitioning, else fallback to sfdisk

Also, update the default ESP size to 2G for composefs installs. This
only applies to sfdisk path.

Closes: bootc-dev#2132

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
When repart.d configuration defines ESP/xbootldr but omits a root
partition definition, previously we failed with a hard error.
Now we perform a dry-run first to detect whether a root
partition is defined. If not, it creates a temporary definitions
directory containing:

 - ESP/xbootldr configs from the existing repart.d
 - A generated root partition config `Type=root` that consumes all
   remaining disk space or a fixed size via `--root-size`

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
If systemd-repart definition for root partition is present in the image,
we don't need the `--filesystem` CLI option to be present. So, we ignore
it until we have enough information from the repart definitions.

This has the ufortunate effect of us not being able to outright detect
if the filesystem will support fs-verity or not during composefs
installs. Now if we have a rootfs that doesn't support fs-verity, but
the composefs repository does not have fs-verity as optional, we will
throw an error during installation instead of throwing an error while
preparing for an install.

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Do not filter the definitions that are supposed to run after boot as we
mount `/sysroot` ro which causes systemd's growfs service to throw an
error as it tries to repartition

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Generated by ClaudeCode

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Updates to the documentation area/install Issues related to `bootc install` ci/tier-1 Run CI for tier-1 OS (centos-10) only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install to-disk should create bigger ESP (likely 2G) for composefs+UKI installations by default

2 participants