feat(grub): install EFI GRUB without loop devices
Metadata
Current evaluation
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.
Suggested action: needs review
Reason: This PR has 11 unresolved review comments and 0 reviewers, indicating it needs maintainer attention. The last activity was 4 days ago, suggesting active development. CI shows failing slow tests on ubuntu-26.04-arm and ubuntu-24.04 that need investigation before merge.
Impact:
70
Quick Win:
17.5
Staleness:
35
Complexity:
75
Confidence:
70
Issue body
## Description
Installs GRUB for EFI/GPT images using FUSE partition mounts (`fuse2fs`), chroot, and `mtools`, eliminating the need for kernel loop devices and host filesystem bind mounts (`/dev`, `/proc`, `/sys`).
### The Problem
Previously, installing GRUB required attaching a kernel loop device to the image, mounting all partitions, bind-mounting host `/dev`, `/proc`, and `/sys`, chrooting in, and running distribution `grub-install` and `update-grub`. This required host root privileges and loop device access, preventing builds in unprivileged environments.
### The Approach
- **FUSE & mtools**: Root (and optional boot) partitions are mounted via FUSE (`mount_partition`). ESP files are written in place with `mtools` without kernel loop devices.
- **Binary Deployment**: Deploys pre-signed Ubuntu shim+GRUB if present (for Secure Boot), or builds a standalone GRUB EFI binary using the image's `grub-mkimage` inside the mounted rootfs.
- **Config Generation**: Uses `update-grub` inside the mounted rootfs (via chroot) to discover kernels and generate `grub.cfg` and ESP stub configs, avoiding the need for `grub-mkimage` in the rootfs. The `grub-probe` stub handles device queries from precomputed UUIDs.
### Scope
Only the **EFI/GPT** path is converted. Legacy BIOS/MBR continues using the loop-device path until a follow-up change.
IMAGECRAFT-176
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/imagecraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [ ] I've added or updated any relevant documentation.
- [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
70
Quick Win:
17.5
Staleness:
35
Complexity:
75
Confidence:
70
|
needs review | 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. | |
| qwen/qwen3.8-27b |
Impact:
75
Quick Win:
13.5
Staleness:
5
Complexity:
82
Confidence:
80
|
needs review | Converts EFI/GPT GRUB install to build the bootloader on the host (grub-mkimage, mtools, debugfs) instead of chroot/loop devices, enabling unprivileged image builds. Part 5 of a stack; BIOS unchanged. +1746/-394, CI mostly green, review pending. | |
| qwen/qwen3.8-27b |
Impact:
72
Quick Win:
12.96
Staleness:
5
Complexity:
82
Confidence:
78
|
needs review | Core of a 5-PR stack replacing chroot/loop-device GRUB install with host-side grub-mkimage + mtools + debugfs for EFI/GPT. Fresh (15d), 2 unresolved review comments, CI slow tests failing, build pending. | |
| qwen/qwen3.8-27b |
Impact:
85
Quick Win:
17.0
Staleness:
5
Complexity:
80
Confidence:
70
|
needs review | Converts EFI/GPT GRUB installation to build grub-mkimage on host and copy via mtools/debugfs, removing loop devices, mounts, and chroot for the EFI path; BIOS still uses old chroot. Part 5 of an unprivileged-build stack. Fresh (15 days, active today), 0 comments, 2 unresolved review comments, 3 slow root CI jobs failing, build/snap-builds pending. | |
| qwen/qwen3.8-27b |
Impact:
62
Quick Win:
7.44
Staleness:
5
Complexity:
88
Confidence:
80
|
keep open | Replaces chroot/loop-device GRUB EFI install with host-based grub-mkimage, mtools, debugfs; adds Secure Boot. Part 5 of unprivileged-build stack; depends on unmerged imgfs PR. 10 files, +1788/-327. 3 slow CI tests failing; build pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
65
Confidence:
90
|
needs review | Replaces chroot-based GRUB EFI installation with host-side build using grub-mkimage and mtools. Currently pending maintainer review with two unresolved comments and passing CI. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
80
Confidence:
85
|
needs review | Replaces chroot-based GRUB EFI installation with host-side generation using grub-mkimage and mtools. Generates grub.cfg directly. Currently awaiting maintainer review with passing CI. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
65
Confidence:
85
|
needs review | Refactors EFI GRUB installation to run without loop devices, mounts, or chroot, enabling unprivileged container builds. Currently awaiting maintainer review with CI spread tests pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
65
Confidence:
90
|
needs review | Implements EFI GRUB installation without loop devices or chroot, enabling unprivileged image builds. Currently pending maintainer review with all CI checks passing. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
75
Confidence:
85
|
needs review | Refactors EFI GRUB installation to run on the host without loop devices, chroot, or root privileges. Builds bootloader, copies to ESP via mtools, and generates grub.cfg. Enables unprivileged image building in containers. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
65
Confidence:
85
|
needs review | Refactors EFI GRUB installation to run without root, loop devices, or chroot by building the bootloader on the host. Currently awaiting maintainer review with CI tests pending. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
65
Confidence:
90
|
needs review | Implements EFI GRUB installation without loop devices or chroot by building the bootloader on the host, copying via mtools, and generating grub.cfg directly. Currently awaiting maintainer review with CI checks running. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
75
Confidence:
90
|
needs review | Refactors EFI GRUB installation to run on the host without loop devices or chroot, enabling unprivileged builds. Currently awaiting maintainer review with mixed CI results. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
80
Confidence:
90
|
needs review | Replaces chroot-based GRUB EFI installation with host-side build using grub-mkimage and mtools. Generates grub.cfg directly. Currently awaiting maintainer review with CI mostly passing. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
65
Confidence:
90
|
needs review | Refactors EFI GRUB installation to run on the host without loop devices, mounts, or chroot. Builds bootloader with grub-mkimage, copies via imgfs, generates grub.cfg directly. Currently pending maintainer review with passing CI. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
10
Complexity:
65
Confidence:
85
|
needs review | Implements EFI GRUB installation without loop devices or chroot by building the bootloader on the host. Currently pending maintainer review with mixed CI results. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
65
Confidence:
85
|
needs review | Converts EFI GRUB installation to run without root, loop devices, or chroot by building the bootloader on the host and using mtools/debugfs. Currently awaiting maintainer review with mixed CI results. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
65
Confidence:
90
|
needs review | Refactors EFI GRUB installation to run without root, loop devices, or chroot by building the bootloader on the host and using mtools/debugfs. Currently pending maintainer review with CI passing. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
5
Complexity:
75
Confidence:
85
|
needs review | Replaces chroot-based GRUB EFI installation with host-side assembly using grub-mkimage and mtools, enabling unprivileged image builds. Currently awaiting maintainer review with CI pending. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| updated | |
| created |
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. | |
| #416 feat(grub): install BIOS GRUB without loop devices or chroot | imagecraft | open | 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. | |
| #433 feat(pack/grubutil): Add FUSE mount support for containerized GRUB installation | imagecraft | open | Adds FUSE mount support for containerized GRUB installation, replacing loop device attachment. New PR with failing CI (lint, fast tests) and 14 unresolved review comments. | |
| #437 feat: zero-mount bootloader installation | imagecraft | open | Replaces privileged loop-device GRUB installation with pre-format-staging bootloader installer, removing loop device requirements for EFI/BIOS boot code installation. All CI passing, 0 reviewers. | |
| #131 Fix grub install | imagecraft | merged | Merged a fix that skips GRUB installation when /boot/efi is missing, preventing packaging failures. Approved by reviewers and passed all CI checks. |