snapcraft fails to launch multipass instance when multipass isn't pre-installed
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
I'm on 22.04, trying to build a core20 snap, and snapcraft fails to launch a `snapcraft` instance.
Turns out it doesn't exist after snapcraft finished configuring multipass:
```
~/grafana-agent-snap> snapcraft
Support for 'multipass' needs to be set up. Would you like to do it now? [y/N]: y
snapd is not logged in, snap install commands will use sudo
multipass 1.14.1 from Canonical✓ installed
Waiting for multipass...
Launching a VM.
launch failed: Remote "snapcraft" is unknown or unreachable. If image mirror is enabled, please confirm it is valid.
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
~/grafana-agent-snap> multipass list
No instances found.
```
Moreover, the multipass instance name isn't "snapcraft" but rather "snapcraft-<snap_name>":
```
~/grafana-agent-snap> snapcraft
Launching a VM.
Build environment is in unknown state, cleaning first.
info failed: The following errors occurred:
instance "snapcraft-grafana-agent" does not exist
Launched: snapcraft-grafana-agent
```
### To Reproduce
From a host that doens't have multipass pre-installed:
```bash
git clone https://github.com/canonical/grafana-agent-snap.git
cd grafana-agent-snap
./make-classic.sh
snapcraft
```
### Environment
Ubuntu 22.04.5
Snapcraft 8.4.4 (12961)
### snapcraft.yaml
```yaml
name: grafana-agent
version: '0.40.4'
summary: A telemetry collector for sending metrics, logs, and trace data
license: Apache-2.0
contact: simon.aronsson@canonical.com
issues: https://github.com/canonical/grafana-agent-snap/issues
source-code: https://github.com/canonical/grafana-agent-snap
website: https://grafana.com
description: "Grafana Agent is a telemetry collector for sending metrics, \nlogs, and trace data to the opinionated Grafana observability stack.\n"
base: core20
grade: stable
confinement: classic
compression: lzo
apps:
grafana-agent:
daemon: simple
command: agent-wrapper
install-mode: disable
restart-condition: on-failure
architectures:
- build-on: amd64
- build-on: arm64
parts:
wrapper:
plugin: dump
source: ./snap/local
source-type: local
override-build: |
cp agent-wrapper.classic $SNAPCRAFT_PART_INSTALL/agent-wrapper
grafana-agent:
plugin: go
source: https://github.com/grafana/agent
source-type: git
source-tag: "v0.40.4"
build-snaps:
- go/1.22/stable
build-packages:
- build-essential
- libsystemd-dev
stage-packages:
- libsystemd0
override-build: |
export USE_CONTAINER=0
export GOFLAGS="-mod=readonly -tags=promtail_journal_enabled"
make agent agentctl
cp build/grafana-agent $SNAPCRAFT_PART_INSTALL/agent
cp build/grafana-agentctl $SNAPCRAFT_PART_INSTALL/agentctl
```
### Relevant log output
```shell
(Inlined in bug description)
```
### Additional context
_No response_
Evaluation history
No evaluation history available.