mmdebstrap plugin leaves /sys mounted when packages trigger mount-busy during bootstrap on EFI hosts
Metadata
Current evaluation
mmdebstrap plugin leaves /sys mounted during EFI bootstrap, causing organize failures, with maintainers currently discussing recursive unmounting fixes.
Suggested action: keep open
Reason: The issue is already triaged, clearly scoped with reproduction steps and a suggested fix, and has active maintainer discussion regarding implementation approaches. It is ready for development and should remain open.
Staleness:
10
Complexity:
45
Support Request:
0
Issue body
## Description
When `mmdebstrap-packages` includes a package whose postinst script accesses `/sys/firmware/efi/efivars` (e.g. `grub-pc`), the plugin leaves `/sys` mounted inside `$CRAFT_PART_INSTALL` after the build step completes, causing the subsequent organize step to fail.
## Root cause
`mmdebstrap --mode=root` bind-mounts the host's `/sys` into the chroot. On EFI hosts, this includes the `efivarfs` submount at `/sys/firmware/efi/efivars`. When `grub-pc`'s postinst runs inside the chroot and accesses efivars, that submount becomes busy. mmdebstrap then emits `W: umount /sys failed: 8192` and exits successfully despite the leftover mount.
The plugin's `get_build_commands` cleans up `/dev/*` and apt state after mmdebstrap, but does not clean up leftover pseudo-filesystem mounts. When craft-parts' organize step subsequently tries to move `$CRAFT_PART_INSTALL/sys` into the overlay it fails with `shutil.Error: [Errno 5] / [Errno 13]` errors from the live sysfs.
## Steps to reproduce
On an EFI host, use the mmdebstrap plugin with `grub-pc` in `mmdebstrap-packages`:
```yaml
parts:
rootfs:
plugin: mmdebstrap
mmdebstrap-packages:
- grub-pc
organize:
"*": (overlay)/
```
## Error
```
W: umount /sys failed: 8192
...
shutil.Error: [('/path/to/parts/rootfs/install/sys/kernel/mm/hugepages/...', ..., '[Errno 5] Input/output error'), ...]
```
## Workaround
Do not use `mmdebstrap-packages` for packages that run `grub-install` during postinst. Install those via `overlay-packages` in a separate `nil` part instead, where craft-parts manages chroot mount lifetime.
## Suggested fix
Add lazy-unmount cleanup for pseudo-filesystems to `get_build_commands`, after the mmdebstrap invocation:
```python
'umount -lf "$CRAFT_PART_INSTALL/sys/firmware/efi/efivars" 2>/dev/null || true',
'umount -lf "$CRAFT_PART_INSTALL/sys" 2>/dev/null || true',
'umount -lf "$CRAFT_PART_INSTALL/proc" 2>/dev/null || true',
'umount -lf "$CRAFT_PART_INSTALL/dev/pts" 2>/dev/null || true',
'umount -lf "$CRAFT_PART_INSTALL/dev" 2>/dev/null || true',
```
This is safe because mmdebstrap should have already unmounted these; the commands are no-ops if it succeeded cleanly.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| 2026-06-01 11:11:49.543413+00:00 | qwen3.6-35b-moe-q4 |
Staleness:
10
Complexity:
45
Support Request:
0
|
keep open | mmdebstrap plugin leaves /sys mounted during EFI bootstrap, causing organize failures, with maintainers currently discussing recursive unmounting fixes. |
| 2026-06-01 11:07:40.822134+00:00 | pending | — | — | — |