Skip to content

efi: Install grub efi modules needed for UKIs (in case they are not b… - #1165

Open
alexlarsson wants to merge 1 commit into
coreos:mainfrom
alexlarsson:add-grub-modules-for-uki
Open

alexlarsson wants to merge 1 commit into
coreos:mainfrom
alexlarsson:add-grub-modules-for-uki

Conversation

@alexlarsson

Copy link
Copy Markdown
Contributor

…uilt in)

We're running into issues with bootc with UKIs on aarch64, because the chain.mod file is not built in to the grub efi file. And anyway we don't know how the grub in the image is built, so just in case we always install fat and chain modules that are needed for UKI menu entries to boot.

…uilt in)

We're running into issues with bootc with UKIs on aarch64, because the
chain.mod file is not built in to the grub efi file. And anyway we don't
know how the grub in the image is built, so just in case we always install
fat and chain modules that are needed for UKI menu entries to boot.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
@openshift-ci

openshift-ci Bot commented Oct 2, 2026

Copy link
Copy Markdown

Hi @alexlarsson. Thanks for your PR.

I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: coreos/bootupd/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 13776069-7a5c-4bd6-9d63-6ab6b7a0f8bb

📥 Commits

Reviewing files that changed from the base of the PR and between c5de0ad and 84b7a87.

📒 Files selected for processing (1)
  • src/efi.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (23)
  • GitHub Check: testing-farm:fedora-rawhide-x86_64
  • GitHub Check: testing-farm:centos-stream-10-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: testing-farm:centos-stream-10-x86_64
  • GitHub Check: testing-farm:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: Tests (release), minimum supported toolchain
  • GitHub Check: Tests, unstable toolchain (beta)
  • GitHub Check: Tests, stable toolchain
  • GitHub Check: Tests, unstable toolchain (nightly)
  • GitHub Check: Lints, pinned toolchain
  • GitHub Check: Tests (release), stable toolchain
  • GitHub Check: Build on ppc64le
  • GitHub Check: Build on s390x
  • GitHub Check: bootc-e2e (ubuntu-24.04-arm, 1)
  • GitHub Check: tmt-tests
  • GitHub Check: bootc-e2e (ubuntu-24.04, 0, 9)
  • GitHub Check: bootc-e2e (ubuntu-24.04, 1)
  • GitHub Check: bootc-e2e (ubuntu-24.04-arm, 0, 10)
  • GitHub Check: bootc-e2e (ubuntu-24.04, 0, 10)
  • GitHub Check: bootc-e2e (ubuntu-24.04-arm, 0, 9)
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
🔇 Additional comments (1)
src/efi.rs (1)

56-63: 🎯 Functional Correctness

The concern is refuted. src/main.rs includes efi.rs only for x86_64, aarch64, and riscv64, and GRUB_EFI_MODULE_DIR defines all three architectures. Other targets cannot compile this module.


📝 Walkthrough

Walkthrough

The change adds architecture-specific GRUB EFI module directories and copies available fat.mod and chain.mod files during GRUB adoption, installation, and update workflows.

Changes

GRUB EFI module copying

Layer / File(s) Summary
Architecture mapping and module copy
src/efi.rs
Adds mappings for aarch64, x86_64, and riscv64. The helper skips missing modules and reports copy failures with the module name.
GRUB workflow integration
src/efi.rs
Invokes the helper after GRUB adoption and updates within the sysroot, and after installation using the source and destination roots.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: johan-liebert1

Merge Risk: ⚪ Minimal · up to 84b7a

No actionable merge-blocking issue was identified; the GRUB module copy paths match the supported boot layout.

🚥 Pre-merge checks | ✅ 3 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title describes the GRUB EFI module change, but it does not follow the required format because the description begins with uppercase "Install" instead of lowercase text after the colon. The visibl… Use the required format with a lowercase, imperative description and no trailing period, for example: "efi: install grub efi modules needed for ukis".
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Commit Message Convention ⚠️ Warning The PR contains one non-merge commit with subject efi: Install grub efi modules needed for UKIs (in case they are not built in). The efi subsystem is valid, and the description is imperative with … Amend the commit subject to efi: install grub efi modules needed for UKIs (in case they are not built in).
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description directly explains the UKI boot issue and the change to install the GRUB fat and chain modules. It is related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title describes the GRUB EFI module change, but it does not follow the required format because the description begins with uppercase "Install" instead of lowercase text after the colon. The visible title is also truncated.

Full details: Commit Message Convention

Explanation

The PR contains one non-merge commit with subject efi: Install grub efi modules needed for UKIs (in case they are not built in). The efi subsystem is valid, and the description is imperative with no trailing period, but it starts with uppercase Install instead of a lowercase letter.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Comment @coderabbitai help to get the list of available commands.

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

LGTM. Might also ask that @Johan-Liebert1 take a look though

Comment thread src/efi.rs
/// Copy the external modules for booting UKIs to /boot when the image provides
/// them. A GRUB EFI binary may already contain these modules.
fn install_grub_efi_modules(source_root: &Dir, target_root: &Dir) -> Result<()> {
let target_dir = format!("boot/grub2/{GRUB_EFI_MODULE_DIR}");

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.

Could we use the GRUB2DIR from grubconfigs.rs here? Cross-distro support is one of the goals for the future, and this would just make it easier to track down where to update this hard-coded path in the future.

@Rolv-Apneseth

Copy link
Copy Markdown
Member

/ok-to-test

Comment thread src/efi.rs

target_root.create_dir_all(&target_dir)?;
let target = target_root.open_dir(&target_dir)?;
source_root

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.

Ideally we'd want to use atomic write APIs

Comment thread src/efi.rs
const GRUB_EFI_MODULE_DIR: &str = "arm64-efi";

#[cfg(target_arch = "x86_64")]
const GRUB_EFI_MODULE_DIR: &str = "x86_64-efi";

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.

I wonder if this is correct. In the image quay.io/fedora/fedora-bootc:rawhide I see

/usr/lib/grub$ uname -m
x86_64
/usr/lib/grub$ ls -a
.  ..  i386-pc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thats the 32bit modules. The 64bit ones are in the grub2-efi-x64-modules rpm, which you probably don't need as the x86-64 grub includes a ton of modules.

@Johan-Liebert1 Johan-Liebert1 Oct 5, 2026 •

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.

My question was regarding this directory itself. In my non-coreos system I see both i386-pc and x86_64-efi inside of /usr/lib/grub, but on coreos and bootc images I only see i386-pc. Wouldn't this always skip the module copy on x86-64 systems?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The grub2-efi-x64-modules rpm is not installed in the coreos x86-64 images, because it is not needed, because on this arch the modules are built-in (on fedora at least). So, indeed, this would skip the copy on x86-64, but that is fine. The problem is on aarch64 where these modules are not built in. Or any non-fedora system where we don't know what is built in or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants