snapcraft clean <part-name> destroys everything when using containers
Metadata
Current evaluation
Fixed targeted container cleanup: `snapcraft clean <part>` no longer deletes the LXD container while other parts remain; merged in #1762 (dbce9a058).
Resolution: closed resolved
Reason: PR #1762 was merged as commit dbce9a058, changing LXD cleanup to remove the build container only after all parts have been removed.
Evaluated by: mr-cal-bot
No scores available.
Issue body
sergiusens ~ source snapcraft snapcraft clean snapcraft
Deleting local:snapcraft-snapcraft
Cleaning priming area for snapcraft
Cleaning staging area for snapcraft
Cleaning build for snapcraft
Cleaning pulled source for snapcraft
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed targeted container cleanup: `snapcraft clean <part>` no longer deletes the LXD container while other parts remain; merged in #1762 (dbce9a058). | |
| stealth/space-bunny-alpha | — | closed resolved | Reported that `snapcraft clean <part-name>` wiped the whole LXD container. kalikiana confirmed and fixed it in merged PR #1762 (commit dbce9a058), which deletes the LXD container only when no parts remain. | |
| stealth/space-bunny-alpha | — | closed resolved | Part-targeted cleaning was implemented in PR #2442 (commit 5546c3aab), resolving container builds cleaning unrelated parts. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without documented fix or comments. The maintainer reported destructive behavior during container-based clean operations, but the issue was abandoned or superseded by subsequent Snapcraft updates. | |
| qwen/qwen3.6-35b-a3b | — | — | snapcraft clean destroys data in container environments. The report was closed without resolution or fix. With zero comments, the bug was abandoned or superseded by later versions. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without comments or resolution, indicating the issue was likely abandoned or superseded. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed by the author with zero comments and no documented fix. The bug report regarding snapcraft clean destroying container data was abandoned without public resolution. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcraft#1762
(confidence 99%)
Merged fix limits container deletion to cleanup after the parts directory is empty.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1727445 Container destroyed on snapcraft clean -s pull | snapcraft (launchpad) | closed | Fixed by snapcraft PR #1655, which corrected clean-step handling so cleaning the pull step no longer unnecessarily destroys the build container. | |
| #1587 lifecycle: clean after deleting container | snapcraft | merged | Merged PR #1587 (commit daca4618b): LXD cleanup logic moved into lxd.py's clean() so `snapcraft clean` removes leftover build containers, addressing the forum-reported container-build clean issue. | |
| #1570708 snapcraft should remove lxd container once finished the build | snapcraft (launchpad) | closed | Closed as invalid after PR #459 found cleanbuild already destroyed its LXD containers; a separate argument-passing failure was fixed by #458 (f78b1e3a3). | |
| #1666735 snapcraft cleanbuild does not work with lxd installed via snap | snapcraft (launchpad) | closed | Fixed by merged canonical/snapcraft#1199 (commit 417989880), making cleanbuild LXD detection packaging-independent instead of relying on apt package metadata. | |
| #1762 lxd: delete container only if parts is empty | snapcraft | merged | Merged PR #1762 (dbce9a058), changing LXD cleanup to delete a build container only after all parts are removed, preserving it for targeted cleans and making repeated cleans safe. | |
| #1546 cli: update parts cache in the container | snapcraft | merged | Merged as 0dde02398: snapcraft update now refreshes the parts cache in the LXD container as well as the host. Complementary container refresh work landed in #1412. | |
| #1591056 snapcraft clean <part> doesn't remove the bin/ directory | snapcraft (launchpad) | closed | Reported that `snapcraft clean <part>` left an empty parts/<part>/bin dir behind. Maintainer confirmed fixed in master (via the pkg-config rework), verified the part dir is fully removed, and closed after the snapcraft.io tour was updated. | |
| #1655 lxd: distinguish argless clean from clean -s pull | snapcraft | merged | Merged in snapcraft#1655 (ed32603c7), fixing LXD cleanup so bare clean removes build containers while clean -s pull preserves or recreates them. | |
| #1746381 snapcraft cleanbuild shouldn't always delete container at end | snapcraft (launchpad) | closed | No fix was made: maintainers confirmed cleanbuild containers were disposable, recommended SNAPCRAFT_CONTAINER_BUILDS, and left the request for default failure shells unimplemented. | |
| #1585 lxd: pass SNAPCRAFT_PARTS_URI through into container | snapcraft | merged | Merged in canonical/snapcraft#1585 (13ea598d5), forwarding SNAPCRAFT_PARTS_URI into LXD containers so cleanbuild can resolve remote parts; fixes Launchpad #1719951. |