Skip to content

disk: check all partitions for boot partition requirement#2459

Merged
supakeen merged 1 commit into
osbuild:mainfrom
lzap:ptable-HMS-10805
Jun 23, 2026
Merged

disk: check all partitions for boot partition requirement#2459
supakeen merged 1 commit into
osbuild:mainfrom
lzap:ptable-HMS-10805

Conversation

@lzap

@lzap lzap commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Function needsBoot exited early if it found a plain root or boot partition or a btrfs root with a boot subvolume. This was not correct, we need to check all partitions to avoid:

panic: the device name "boot" has been generated for two different devices

Example customization that caused the panic:

    [[customizations.disk.partitions]]
    type = "plain"
    fs_type = "vfat"
    minsize = "1 GiB"
    mountpoint = "/boot/efi"

    [[customizations.disk.partitions]]
    name = "vg"
    type = "lvm"
    minsize = "1 GiB"

    [[customizations.disk.partitions.logical_volumes]]
    name = "lv_root"
    fs_type = "xfs"
    minsize = "20 GiB"
    mountpoint = "/"

    [[customizations.disk.partitions]]
    type = "plain"
    fs_type = "xfs"
    minsize = "2 GiB"
    mountpoint = "/boot"

Reordering the partitions would fix the problem, but this was a insights customer who were running into this.


https://redhat.atlassian.net/browse/HMS-10805

Function needsBoot exited early if it found a plain root or boot partition or a
btrfs root with a boot subvolume. This was not correct, we need to check all
partitions to avoid:

panic: the device name "boot" has been generated for two different devices

Example customization that caused the panic:

        [[customizations.disk.partitions]]
        type = "plain"
        fs_type = "vfat"
        minsize = "1 GiB"
        mountpoint = "/boot/efi"

        [[customizations.disk.partitions]]
        name = "vg"
        type = "lvm"
        minsize = "1 GiB"

        [[customizations.disk.partitions.logical_volumes]]
        name = "lv_root"
        fs_type = "xfs"
        minsize = "20 GiB"
        mountpoint = "/"

        [[customizations.disk.partitions]]
        type = "plain"
        fs_type = "xfs"
        minsize = "2 GiB"
        mountpoint = "/boot"

Reordering the partitions would fix the problem, but this was a insights
customer who were running into this.
@lzap lzap requested review from a team and achilleas-k as code owners June 23, 2026 12:03
@lzap lzap requested review from brlane-rht and supakeen June 23, 2026 12:03

@achilleas-k achilleas-k left a comment

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.

Nice work. LGTM.
That function is getting a bit complicated but the disk package has always been a place that requires some complex logic.

One small note: Does the function docstring cover everything still or should we expand it to more clearly describe all scenarios?

@supakeen

Copy link
Copy Markdown
Member

Nice work. LGTM. That function is getting a bit complicated but the disk package has always been a place that requires some complex logic.

One small note: Does the function docstring cover everything still or should we expand it to more clearly describe all scenarios?

I think it's clear-ish; from the current docstring for the function it just says that it will find out if there's a boot thingy nothing about the ordering 🙂

@supakeen

Copy link
Copy Markdown
Member

Also, do we later re-order the partitions at all? Having /boot be the last partition on disk would get in the way of cloud-init / systemd-repart or hyperscaler-specific guest utilities automatically resizing the root partition.

@achilleas-k

achilleas-k commented Jun 23, 2026

Copy link
Copy Markdown
Member

Also, do we later re-order the partitions at all? Having /boot be the last partition on disk would get in the way of cloud-init / systemd-repart or hyperscaler-specific guest utilities automatically resizing the root partition.

For disk customizations, we explicitly made it so the user defined order is respected and documented it as such: https://osbuild.org/docs/user-guide/partitioning/#general-principles and https://osbuild.org/docs/user-guide/partitioning/#order.

Yes, that would interfere with resize tooling, but when we were designing the customizations we were always thinking about it in terms of "user makes their own PT", as long as it's valid.

Breaking cloud-init and repart is a valid concern, but I also think there are valid use cases for letting users lay things out exactly the way they want them, for whatever reason they need.

@supakeen supakeen added this pull request to the merge queue Jun 23, 2026
Merged via the queue into osbuild:main with commit 8700b18 Jun 23, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants