Unable to make snapcraft build for core20

Hello,

Should I be able to build snaps for base core20? I am getting the following error when I attempt a build:

Launching a VM.
launch failed: Unable to find an image matching "core20"                        
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.

I don’t get this issue for core18, so I believe that snapcraft and multipass are set up fine. The core20 snap is installed, and I changed to the candidate release of snapcraft (v4.0).

Thanks.

Hey @electricworry, core20 is not yet stable, so not everything is in place.

You can use the edge channel of Multipass, or pass --use-lxd to Snapcraft.

Excellent thanks, @Saviq. This option works and I’m happy using LXD. Really appreciate the fast response!

Hi! I’m working on Ubuntu 18.04 LTS and wanted to create a snap package using the core20 as the base. I’ve snapcraft 4.0.7 installed and I’m able to see core20 as stable:

$ snap info core20                                                                                                                                                                                                                  
name:      core20
summary:   Runtime environment based on Ubuntu 20.04
publisher: Canonical✓
store-url: https://snapcraft.io/core20
contact:   https://github.com/snapcore/core20/issues
license:   unset
description: |
  The base snap based on the Ubuntu 20.04 release.
type:         base
snap-id:      DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q
tracking:     latest/stable
refresh-date: 19 days ago, at 20:09 +03
channels:
  latest/stable:    20 2020-05-07 (634) 63MB -
  latest/candidate: 20 2020-05-07 (634) 63MB -
  latest/beta:      20 2020-05-27 (696) 63MB -
  latest/edge:      20 2020-06-24 (722) 63MB -
installed:          20            (634) 63MB base

When I try to build the package, I’m getting an error:

$ snapcraft build --shell
Launching a VM.
launch failed: Unable to find an image matching "core20"                        
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.

Btw if I retry the command, the error changes:

$ snapcraft build --shell                                                                                                                                                                                                         ⏎ 
Launching a VM.
Build instance created with incompatible snapcraft, cleaning.
delete failed: The following errors occurred:
instance "snapcraft-gradle" does not exist
An error occurred with the instance when trying to delete with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.

Hi,

Not one of the team, so I’m not authoritative, but I believe (and it’s my experience) that core20 builds do not work unless you specify “snapcraft --use-lxd”. The multipass method simply doesn’t work with core20 yet and you need to use LXD.

Good luck.

I use core20 myself, with no issues, without passing --use-lxd. Maybe because I use option --destructive-mode?

Got LXD up & running. (had to issue lxd init myself as snapcraft’s attempt failed) Now I’m getting this:

$ snapcraft --use-lxd --debug                                                                                                                                                                                                       
Launching a container.
Build instance created with incompatible snapcraft, cleaning.
Sorry, an error occurred in Snapcraft:
Failed to get ID map: Host id is in the range of subids
We would appreciate it if you anonymously reported this issue.
No other data than the traceback and the version of snapcraft in use will be sent.
Would you like to send this error data? (Yes/No/Always/View) [no]: Yes

If though it’s failed, I’m able to see a container in STOPPED state:

$ lxc list                                                                                                                                                                                                                        
+------------------+---------+------+------+-----------+-----------+
|       NAME       |  STATE  | IPV4 | IPV6 |   TYPE    | SNAPSHOTS |
+------------------+---------+------+------+-----------+-----------+
| snapcraft-gradle | STOPPED |      |      | CONTAINER | 0         |
+------------------+---------+------+------+-----------+-----------+

Just found out that there is a new multipass snap available. Will update & test.

With multipass:1.3.0, I’m able to use core20 without --use-lxd option.