← Back to issue list

feat(grub): install BIOS GRUB without loop devices or chroot

View original Github issue

Metadata

Project
imagecraft
Number
#416
Type
pull request
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Part 6 of a stack refactoring GRUB BIOS/MBR installation to work without root privileges, removing chroot and loop device dependencies. Under review with 3 unresolved comments.

Suggested action: needs review

Reason: The PR has 3 unresolved review comments and a pending review status with 0 comments. Last activity was 5 days ago, indicating it's still active. This is a significant architectural change (28 files, +3616/-354 lines) that removes chroot/loop device dependencies for rootless GRUB installation, requiring careful maintainer review.

Impact: 70 Quick Win: 17.5 Staleness: 30 Complexity: 75 Confidence: 65

Issue body

Part 6 of a stack that makes GRUB installation work without root privileges. Converts the remaining BIOS/MBR path to the same unprivileged approach the EFI path already uses, and deletes the chroot implementation. BIOS booting is fiddlier than EFI because there is no filesystem involved at the start -- the firmware just executes the first sector. So instead of copying files into a partition, we: 1. Build `core.img` on the host with `grub-mkimage`. 2. Copy the boot sector out of GRUB's `boot.img` into sector 0 of the image. 3. Write `core.img` into the post-MBR gap. 4. Patch the boot sector with the sector where `core.img` starts and its blocklist, which is the part `grub-install` would normally do for us. With both firmware types converted, `setup_grub` no longer mounts anything or attaches loop devices at all, so `_grub_install`, `_image_mounts` and the transitional `_setup_grub_bios_chroot` wrapper introduced in the previous PR are removed. Adds `tests/spread/boot/classic-mbr`, which boots a BIOS image under QEMU's SeaBIOS (no OVMF) and asserts it reaches userspace -- i.e. that the hand-written boot sector and blocklist actually work.

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6
Impact: 70
Quick Win: 17.5
Staleness: 30
Complexity: 75
Confidence: 65
needs review Part 6 of a stack refactoring GRUB BIOS/MBR installation to work without root privileges, removing chroot and loop device dependencies. Under review with 3 unresolved comments.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 30
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot. Removes legacy chroot wrapper and adds a SeaBIOS QEMU test. Currently pending maintainer review with 3 unresolved comments.
qwen/qwen3.6-35b-a3b
Staleness: 10
Complexity: 45
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, aligning it with the existing EFI approach. Removes legacy chroot code and adds a QEMU SeaBIOS test. Currently awaiting maintainer review with passing CI.
qwen/qwen3.6-35b-a3b
Staleness: 10
Complexity: 65
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, removes legacy wrappers, and adds a SeaBIOS QEMU test. Currently pending maintainer review with 3 unresolved comments.
qwen/qwen3.6-35b-a3b
Staleness: 15
Complexity: 65
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, removes legacy chroot code, and adds a SeaBIOS QEMU test. Currently pending maintainer review with passing CI.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, removes legacy code, and adds a SeaBIOS spread test. Currently pending review with one failing OSV security scan.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, aligning with the existing EFI path. Removes legacy chroot code and adds SeaBIOS QEMU tests. Currently pending maintainer review with CI mostly passing.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 65
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, aligning it with the existing EFI path. Removes legacy chroot wrappers and adds a SeaBIOS boot test. Currently awaiting maintainer review with CI mostly passing.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 65
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, removes legacy chroot code, and adds SeaBIOS QEMU tests. Currently awaiting maintainer review with CI checks in progress.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, removing legacy chroot code and adding a QEMU SeaBIOS test. Currently awaiting maintainer review with CI checks pending.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 90
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, removes legacy chroot code, and adds a QEMU SeaBIOS test. Currently pending maintainer review with mixed CI status.
qwen/qwen3.6-35b-a3b
Staleness: 0
Complexity: 45
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, aligning with the existing EFI path. Removes legacy chroot code and adds a QEMU SeaBIOS test. Currently pending maintainer review with mixed CI results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 65
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, removing legacy wrappers. Currently pending maintainer review with failing CI checks on build, lint, and slow tests.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged method without loop devices or chroot, removes legacy chroot code, and adds a QEMU SeaBIOS boot test. Currently pending maintainer review with mixed CI results.
qwen/qwen3.6-35b-a3b
Staleness: 5
Complexity: 45
Confidence: 85
needs review Converts BIOS GRUB installation to an unprivileged approach without loop devices or chroot, removing legacy wrappers and adding a SeaBIOS integration test. Currently awaiting maintainer review with CI checks pending.

Update history

Date Change
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
updated
created

Related work

  • Related To: canonical/imagecraft#338 (confidence 80%)

    Original MBR image support PR that introduced the chroot-based BIOS GRUB installation this PR replaces.

  • Related To: canonical/imagecraft#410 (confidence 75%)

    Recent merged PR installing grub tooling in make setup, enabling rootless test execution relevant to this refactoring.

Related issues

Issue Project State Summary Similarity
#434 feat(grub): loop-device-free EFI GRUB setup imagecraft open Part of a GRUB refactoring stack implementing loop-device-free EFI GRUB setup. Fresh PR with 7 unresolved review comments and no maintainer engagement yet.
79%
#417 refactor: remove the now-unused chroot and loop device helpers imagecraft open Removes unused chroot handler and loop device helpers after GRUB installation was refactored to work without root privileges. Part 7 of a 7-part stack. No reviewer engagement yet.
79%
#415 feat(grub): install EFI GRUB without loop devices imagecraft open PR converts EFI/GPT GRUB installation to use FUSE partition mounts instead of kernel loop devices, enabling unprivileged image builds. Has 11 unresolved review comments and some failing CI slow tests.
78%
#348 No loops for grub imagecraft open Refactors grub handling to avoid loop devices, replacing special handling with a more generic approach. Stalled for 100 days pending maintainer feedback on architectural direction.
73%