Skip to content

fix(pack): fix GRUB EFI stub and classic boot test setup - #385

Draft
lengau wants to merge 13 commits into
mainfrom
work/IMAGECRAFT-176/fix-main
Draft

fix(pack): fix GRUB EFI stub and classic boot test setup#385
lengau wants to merge 13 commits into
mainfrom
work/IMAGECRAFT-176/fix-main

Conversation

@lengau

@lengau lengau commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix GRUB EFI stub generation in grubutil.py to avoid hardware serial driver overrides in UEFI mode, which conflict with OVMF firmware and cause QEMU to hang at BdsDxe: starting Boot0001.
  • Refactor EFI fallback setup helper functions (_extract_root_uuid and _populate_uefi_fallback) to satisfy linter and complexity rules.
  • Update tests/spread/boot/classic/imagecraft.yaml to configure GRUB_RECORDFAIL_TIMEOUT=1, set GRUB_TERMINAL="console serial", and create the multi-user.target.wants/boot-sentinel.service symlink directly in the overlay.
  • Update tests/spread/boot/classic/task.yaml to include a QEMU timeout and assert sentinel output in output.log.
  • Temporarily pin craft-application to the work/fix-1152 branch (canonical/craft-application#1153) to fix tests/spread/pack/non-sequential-partitions and tests/spread/pack/sector-write, which were crashing on all systems with UnknownVersionError: Unknown version ubuntu devel. This happens because ProjectService.is_effective_base_eol() doesn't special-case a devel base the way its sibling methods (check_base_is_supported()/base_eol_soon_date()) do, so --ignore=unmaintained + build-base: devel crashes instead of proceeding. Filed as canonical/craft-application#1152; revert to a released craft-application~=7.1 once #1153 is merged and released.
  • Remove local editor/agent tooling artifacts (.agents/, .kdev4/, imagecraft.kdev4, .workshop/) and unrelated scratch files (TODO.md, contributors.html, docs/release-notes/imagecraft-0-2-0.rst) that were accidentally committed.

- Fix GRUB EFI stub generation in grubutil.py to avoid hardware serial overrides in UEFI mode, which conflict with OVMF and cause QEMU to hang.
- Update tests/spread/boot/classic/imagecraft.yaml to configure recordfail timeout, serial terminal, and manual boot-sentinel service symlinking.
- Update tests/spread/boot/classic/task.yaml to include a QEMU timeout and check output log for sentinel output.
Copilot AI review requested due to automatic review settings July 23, 2026 18:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses UEFI boot hangs in the “classic” QEMU boot test flow by adjusting how GRUB EFI stubs/fallback paths are generated and by tightening the spread test’s boot-time configuration and assertions.

Changes:

  • Update GRUB UEFI install logic to force a consistent /EFI/ubuntu layout and populate a UEFI fallback EFI/BOOT sibling GRUB binary + grub.cfg stub.
  • Refactor/adjust the classic boot test image overlay to improve deterministic serial/menu behavior and enable the sentinel service via direct unit symlink.
  • Update the classic spread task to add a QEMU timeout and validate sentinel output in output.log.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/spread/boot/classic/task.yaml Adds a QEMU timeout and changes the disk interface used by QEMU, then asserts sentinel output from the serial log.
tests/spread/boot/classic/imagecraft.yaml Tweaks GRUB defaults for serial/menu behavior and adjusts how the sentinel systemd unit is enabled in the overlay.
imagecraft/pack/grubutil.py Forces --bootloader-id=ubuntu, adds UEFI fallback population, and changes chroot /dev mounting behavior to expose host loop devices.

Comment thread tests/spread/boot/classic/task.yaml Outdated
-drive if=pflash,format=raw,readonly=on,file=$UEFI_CODE \
-drive if=pflash,format=raw,file=/tmp/uefi_vars.fd \
-drive file=pc.img,format=raw,index=0,if=virtio 2>&1 | tee output.log || true
-drive file=pc.img,format=raw,index=0,if=ide 2>&1 | tee output.log || true
Comment thread tests/spread/boot/classic/task.yaml Outdated
cp "$UEFI_VARS" /tmp/uefi_vars.fd

$QEMU_BIN \
timeout 180 $QEMU_BIN \
lengau and others added 11 commits July 23, 2026 18:33
Add --ignore=unmaintained flag to imagecraft pack commands in tests that run
on all systems, including Ubuntu 25.10 which is now EOL. This allows the tests
to continue running without failures due to unmaintained base distributions.

Affected tests:
- tests/spread/pack/simple/task.yaml
- tests/spread/pack/non-sequential-partitions/task.yaml
- tests/spread/pack/sector-write/task.yaml

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update craft-providers constraint from ~=3.0 to ~=3.7 to ensure we use the
latest bug fixes and improvements in the 3.7.x series. This helps support
newer Ubuntu versions like 26.04.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
is_effective_base_eol() crashes with UnknownVersionError when
build-base: devel is used with --ignore=unmaintained, since it lacks
the same devel/unknown-base handling as its sibling methods
check_base_is_supported()/base_eol_soon_date(). This broke
tests/spread/pack/non-sequential-partitions and
tests/spread/pack/sector-write on all systems.

Point craft-application at the canonical/craft-application#1153 fix
branch until it's merged and released, then switch back to a
released craft-application~=7.1.

Fixes canonical/craft-application#1152

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Commit 0c879c9 unintentionally included local editor/agent tooling
config and scratch files that don't belong in the repository:
- .agents/, .kdev4/, imagecraft.kdev4, .workshop/ (local IDE/agent
  config)
- TODO.md and contributors.html (personal scratch notes /
  generated report, referencing a local file path)
- docs/release-notes/imagecraft-0-2-0.rst (belongs to the separate
  0.2.0 release-notes work, not this branch)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lengau
lengau force-pushed the work/IMAGECRAFT-176/fix-main branch from 3ae763a to 396f873 Compare August 10, 2026 22:08
…d change

Pointing craft-application at the work/fix-1152 branch (based on
current main) pulls in an unrelated upstream change: LifecycleManager's
ignore_outdated now also includes ".spread-reuse.*" to avoid re-pulling
sources when spread test files change. Update the expected call to
match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants