Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapcraft fails to launch multipass instance when multipass isn't pre-installed #5145

Open
sed-i opened this issue Nov 18, 2024 · 2 comments
Labels
enhancement New features or optimizations triaged

Comments

@sed-i
Copy link

sed-i commented Nov 18, 2024

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:

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

name: grafana-agent
version: '0.40.4'
summary: A telemetry collector for sending metrics, logs, and trace data
license: Apache-2.0
contact: [email protected]
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

(Inlined in bug description)

Additional context

No response

@mr-cal
Copy link
Collaborator

mr-cal commented Nov 19, 2024

Thanks for the report.

This comes up when someone is running on a non-amd64 platform or when the image servers are unavailable, either from a local or remote network issue. We've had similar reports in #4106.

We have an open issue to improve how this error is presented to the user.

@mr-cal mr-cal added enhancement New features or optimizations triaged labels Nov 19, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3705.

This message was autogenerated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or optimizations triaged
Projects
None yet
Development

No branches or pull requests

2 participants