Snapcraft can't re-use build VM if anything went wrong with the initial setup
Metadata
Current evaluation
Fixed by the Multipass provider check merged in PR #3381 as commit 51e75b4de.
Resolution: closed resolved
Reason: Commit 51e75b4de from PR #3381 updates the Multipass provider to check whether an instance exists before deletion, resolving failed build-VM reuse.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I made the mistake of trying build VMs from source, which installs snapcraft from the stable channel in the VM, which doesn't support managed-host as a build environment. This error looks like this:
$ SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft
Launching a VM.
Launched: snapcraft-my-snap-name
2018-09-26T09:54:29Z INFO Waiting for restart...
core 16-2.35 from 'canonical' installed
snapcraft 2.43.1 from Canonical✓ installed
SNAPCRAFT_BUILD_ENVIRONMENT must be one of: 'host' or 'lxd'.
An error occurred when trying to execute 'snapcraft refresh' with 'multipass': returned exit code 2.
Okay, so I installed a snap on my host that I knew would work, and ran again:
$ SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft
Launching a VM.
failed to launch: instance "snapcraft-my-snap-name" already exists
An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
I need to either run `SNAPCRAFT_BUILD_ENVIRONMENT=multipass snapcraft clean` or blow away the instance manually using multipass in order to continue. Snapcraft should handle this situation better.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by the Multipass provider check merged in PR #3381 as commit 51e75b4de. | |
| stealth/space-bunny-alpha | — | closed stale | Closed without a documented fix or linked PR after years of inactivity; failed Multipass setup and subsequent VM reuse remained unresolved. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without documented resolution. The report detailed Snapcraft failing to recover build VMs after setup errors, requiring manual instance cleanup. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and likely abandoned. Snapcraft lacks automatic recovery for failed VM setups, forcing manual cleanup. No resolution was provided, suggesting the issue was superseded by updated build environment handling. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution or comments, likely abandoned due to inactivity. Snapcraft still requires manual cleanup of failed build VM instances when initial setup errors occur. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. Snapcraft failed to recover from initial VM setup errors, requiring manual cleanup. With no discussion or linked fixes, it was likely abandoned or superseded by updated build environment handling. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcraft#3381
(confidence 96%)
The merged change is titled “multipass provider: check if instance exists before deleting” and directly addresses stale VM handling.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1904774 Snapcraft runs multipass setup but fails | snapcraft (launchpad) | closed | Fixed in merged PR #3381 via commit 51e75b4de: Multipass cleanup now checks whether the VM instance exists before deleting it. | |
| #5145 snapcraft fails to launch multipass instance when multipass isn't pre-installed | snapcraft | open | Snapcraft emits cryptic 'Remote "snapcraft" is unknown or unreachable / exit code 2' when Multipass can't launch the build instance; maintainer traced it to image-server unavailability or non-amd64 hosts, fix tracked in craft-providers#211 | |
| #2293 build providers: use the new snapcraft: remote for multipass | snapcraft | merged | Merged PR #2293 as commit 66060e839, switching Multipass builds to the snapcraft: remote and delegating unsupported-base errors to Multipass. | |
| #1813979 snapcraft cleanbuild wants to install multipass but it's already installed | snapcraft (launchpad) | closed | Deb-packaged Snapcraft 2.43.1 failed while Multipass worked in 3.0.1. Legacy cleanbuild was later removed because builds are clean by default. | |
| #1803708 Snapcraft should detect being run inside multipass and error | snapcraft (launchpad) | closed | Rejected: maintainers chose to allow running Snapcraft inside Multipass, so no environment-detection error was added. | |
| #1869542 snapcraft unable to find snap/snapcraft.yaml file | snapcraft (launchpad) | open | Snapcraft 3.11 on Multipass intermittently lost the project dir in the VM ('Could not find snap/snapcraft.yaml'), only fixable by `snapcraft clean`. Reproducer never supplied; reporter redirected it to the Multipass tracker and never followed up. | |
| #1806083 snapcraft fails to locate multipass (inside a multipass session) | snapcraft (launchpad) | open | Snapcraft 3.0.1 falsely reported Multipass missing inside a Multipass guest; Darwin-only detection in e9ae8d29f addressed the old path, but the Launchpad record remains open. | |
| #1996511 snapcraft try with multipass provider crashes | snapcraft (launchpad) | closed | Snapcraft try with Multipass and core22 was fixed by snapcore/snapcraft#3981 (commit 2691262b8) and shipped in Snapcraft 7.3. | |
| #1975468 Snapcraft build fails, because multipass cannot download cloudimg | snapcraft (launchpad) | closed | Snapcraft core20 builds were disrupted by Multipass cloud-image download failures; Launchpad closed the report without documenting a fix, resolving PR, commit, or follow-up. | |
| #1943242 snapcraft can't build while I'm also running virtual box | snapcraft (launchpad) | open | Report: snapcraft builds fail when Multipass conflicts with a running VirtualBox ("Another virtual machine manager is currently running"); reporter calls it a fundamental Multipass limitation. No maintainer response in ~5 years. |