fix: Make mounted devices private before recursively unmounting the chroot
Metadata
Current evaluation
Merged PR #1348 fixed chroot cleanup by making device mounts private and recursively unmounting package-created submounts; commit aea85f07 closes #1344.
Resolution: closed resolved
Reason: PR #1348 was merged as commit aea85f07, implementing recursive private unmounting and resolving issue #1344.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the guidelines for contributing?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint && make test`?
- [x] Have you added an entry to the changelog (`docs/reference/changelog.rst`)?
---
When cleaning the chroot, before unmounting mounted devices, remount them as recursively private. Also recursively umount every device to account for submounts added by package installation.
Manually tested with Imagecraft, installing packages in the overlay with the following part:
```yaml
packages:
plugin: nil
overlay-packages:
- ubuntu-server-minimal
- grub2-common
- grub-pc
- shim-signed
- linux-image-generic
overlay-script: |
rm $CRAFT_OVERLAY/etc/cloud/cloud.cfg.d/90_dpkg.cfg
```
Also tested with Rockcraft, see https://github.com/canonical/rockcraft/pull/986
Fixes #1344
CRAFT-4804
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1348 fixed chroot cleanup by making device mounts private and recursively unmounting package-created submounts; commit aea85f07 closes #1344. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1348 (commit aea85f07) fixes #1344: chroot cleanup now remounts devices as recursively private and unmounts recursively to handle package-created submounts (CRAFT-4804). | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #1348 (commit aea85f07), fixing #1344 by making mounted devices private and recursively unmounting chroot submounts. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix that remounts chroot devices as private before recursive unmounting to properly handle submounts. Resolves #1344. Approved by reviewers and passed all CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Fixes chroot cleanup by remounting devices as recursively private before unmounting, preventing errors from package submounts. Resolves #1344 and CRAFT-4804. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#1344
(confidence 100%)
The PR explicitly states that it fixes #1344.
-
Related To:
canonical/rockcraft#986
(confidence 90%)
The PR was manually validated through Rockcraft-related testing.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #400 chroot: mark /dev mount as private | craft-parts | merged | Merged PR #400 as commit 21bbb6dd, making chroot /dev bind mounts recursively private to prevent shared-mount unmount propagation. | |
| #1344 More robust chroot unmounting | craft-parts | closed | Fixed in canonical/craft-parts#1348 (commit aea85f07) by making chroot mounts private before recursively unmounting package-created submounts. | |
| #118 Be stricter when mounting and safer when umounting | imagecraft | closed | Fixed by merged canonical/imagecraft#126 (15871f5): missing mountpoints now fail early, and chroot cleanup attempts every unmount before reporting errors. |