Skip to content

Only enforce /boot location limit on non-EFI systems (#2391443)#1437

Merged
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_boot-limit-fix
Nov 28, 2025
Merged

Only enforce /boot location limit on non-EFI systems (#2391443)#1437
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_boot-limit-fix

Conversation

@vojtechtrefny
Copy link
Member

@vojtechtrefny vojtechtrefny commented Nov 21, 2025

We currently require the /boot partition to be placed in a way the last sector is under 2 TiB. This is an old check that predates EFI and GPT and should not apply on these systems.

Summary by Sourcery

Bug Fixes:

  • Avoid incorrectly enforcing the 2 TiB /boot location limit on EFI systems that do not have this constraint.

We currently require the /boot partition to be placed in a way the
last sector is under 2 TiB. This is an old check that predates EFI
and GPT and should not apply on these systems.
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Skips the legacy 2 TiB end-sector constraint for /boot partition placement when running on EFI systems, while preserving the limit on non-EFI systems.

Flow diagram for applying /boot 2_TiB limit based on EFI detection

flowchart TD
    A[get_best_free_space_region called] --> B[Is /boot partition requested? boot flag]
    B -- No --> C[Skip /boot size constraint]
    C --> D[Evaluate free space region normally]

    B -- Yes --> E[Call is_efi]
    E -- System is EFI --> F[Do not enforce 2_TiB /boot end-sector limit]
    F --> D

    E -- System is not EFI --> G[Set max_boot to 2_TiB]
    G --> H[Compute free_start from free_geom and sectorSize]
    H --> I[Compute req_end as free_start + req_size]
    I --> J[Check that req_end <= max_boot]
    J --> K[If req_end exceeds max_boot, reject this free space region]
    K --> D
Loading

File-Level Changes

Change Details Files
Conditionally apply the 2 TiB /boot partition end-sector limit only on non-EFI systems.
  • Import EFI detection helper to check whether the system is EFI-based.
  • Update the boot-partition placement logic to bypass the 2 TiB constraint when EFI is detected, keeping existing behavior for non-EFI systems.
blivet/partitioning.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@vojtechtrefny vojtechtrefny marked this pull request as ready for review November 28, 2025 06:26
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Using is_efi() here ties the /boot constraint to the environment where blivet runs rather than the target system; if this code can operate on non-local/alternate targets (e.g., image creation, chroot installs), consider plumbing a target-boot-mode flag into get_best_free_space_region instead of calling is_efi() directly.
  • It might be helpful to add a brief code comment explaining why the 2 TiB limit is skipped on EFI (i.e., historical BIOS/MBR constraint) so future readers don’t reintroduce or refactor this check without understanding the context.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `is_efi()` here ties the /boot constraint to the environment where blivet runs rather than the target system; if this code can operate on non-local/alternate targets (e.g., image creation, chroot installs), consider plumbing a target-boot-mode flag into `get_best_free_space_region` instead of calling `is_efi()` directly.
- It might be helpful to add a brief code comment explaining why the 2 TiB limit is skipped on EFI (i.e., historical BIOS/MBR constraint) so future readers don’t reintroduce or refactor this check without understanding the context.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@vojtechtrefny vojtechtrefny merged commit 5198b86 into storaged-project:main Nov 28, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant