Run grub2-install inside the install chroot to use target image's modules#762
Open
vinceaperri wants to merge 4 commits into
Open
Run grub2-install inside the install chroot to use target image's modules#762vinceaperri wants to merge 4 commits into
vinceaperri wants to merge 4 commits into
Conversation
3ce1163 to
a6822a5
Compare
cwize1
previously approved these changes
Jun 5, 2026
cwize1
requested changes
Jun 5, 2026
a7a0f03 to
74dda02
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes legacy (BIOS) bootloader installation to run grub2-install inside the target image’s install chroot so it uses the target image’s GRUB modules instead of the build host’s.
Changes:
- Run
grub2-installviashell.NewExecBuilder(...).Chroot(...)(and drop the host-sidegrub-installfallback). - Update legacy boot functional test config to install
grub2-pcinto the target image and adjust the test to use base-image RPM repos. - Remove GRUB packages from the Image Customizer container and update host prerequisite documentation / CI package lists accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| toolkit/tools/pkg/imagecustomizerlib/versionsOfToolDependencies.go | Stops logging host-side grub-install version since GRUB install is no longer host-executed. |
| toolkit/tools/pkg/imagecustomizerlib/testdata/legacyboot-config.yaml | Ensures grub2-pc is installed in the target image for legacy boot tests. |
| toolkit/tools/pkg/imagecustomizerlib/customizepartitions_test.go | Switches legacy test flow to use base-image RPM repos so the new package install succeeds. |
| toolkit/tools/imagegen/installutils/installutils.go | Runs grub2-install inside the install chroot to use target-image modules. |
| toolkit/tools/imagecustomizer/container/imagecustomizer.Dockerfile | Removes GRUB packages and adds systemd-udev to satisfy udev tooling needs. |
| toolkit/tools/imagecustomizer/container/build-container.sh | Drops arm64-only Dockerfile patching that is no longer needed after GRUB removal. |
| docs/imagecustomizer/quick-start/quick-start-binary.md | Updates host prerequisite lists to remove GRUB tools/packages. |
| .github/workflows/tests-functional.yml | Removes GRUB packages from functional-test host prerequisites (since GRUB install is now in-chroot). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
liulanze
reviewed
Jun 8, 2026
74dda02 to
92b67f3
Compare
cwize1
reviewed
Jun 10, 2026
cwize1
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Image Customizer installs the legacy (BIOS) bootloader by running
grub2-installon the build host, which copies grub modules from the host'sgrub2-pcinto the target image. When the host's grub differs from the target's grub, the copied modules don't match thegrub.cfgthe target's owngrub2-mkconfigproduces, and the image fails to boot. Concretely, the AZL3-based IC container building an AZL4 image produces a disk whosegrub.cfgdoesinsmod blscfgwhile/boot/grub2/i386-pc/was populated from AZL3 (no BLS modules), so it errors withfile '.../blscfg.mod' not foundon boot.Fix
Install the legacy bootloader from the target's own
grub2-install, run inside the install chroot, so the bootloader and its modules always come from the target. Behavior when the target does not shipgrub2-pc:grub2-pcpresent (any version)grub2-installin the chroot (modules come from the target).grub2-pcgrub2-installwith a warning — preserves the existing behavior for images whose configs predate this requirement.grub2-pcgrub2-pctoos.packages.install.Container: explicitly install
systemd-udevThe IC container's host-side disk setup calls
udevadm settle(waitForDevicesToSettle).udevadmis provided by thesystemd-udevpackage, which until now arrived only transitively viagrub2.systemd-udevis now listed explicitly inimagecustomizer.Dockerfilesoudevadmcan never silently disappear if the grub2 dependency changes.Testing
TestCustomizeImagePartitionsLegacyexercises the chroot path (config installsgrub2-pc);TestCustomizeImagePartitionsLegacy_TargetMissingGrub2Pcexercises the no-grub2-pcpath across AZL2/3/4 — asserting success + a valid legacy image for AZL2/3 (host fallback) and agrub2-pcerror for AZL4.test_legacy_bootloader_reset_azl{2,3,4}boot a hard-reset legacy image built withgrub2-pc(chroot path);test_legacy_bootloader_reset_fallback_azl{2,3}boot one built without it (host fallback).Docs
storage.mddocuments the newbootType: legacybehavior and thegrub2-pcrequirement.