Score:0

Trouble completing snapcraft tutorial on Ubuntu 20.04, Raspberry Pi 4

tn flag

I am trying to package my first snap with the ultimate goal of deploying an app on Ubuntu Core 20. I am new to snapcraft and multipass, so I'm following the "Create Your First Snap" tutorial on the Ubuntu website.

I am building on a Raspberry Pi 4, running Ubuntu Server 20.04 LTS. Once the snap is packaged, I want to then be able to copy it to another Raspberry Pi 4 which is running Ubuntu Core 20.

I have followed the instructions carefully.. installed snapcraft, initialised a new snap, and edited the snapcraft.yaml file with the example content from the tutorial:

name: hello
base: "core18"
version: '2.10'
summary: GNU Hello, the "hello world" snap
description: |
  GNU hello prints a friendly greeting.
grade: devel
confinement: devmode

parts:
  gnu-hello:
    source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
    plugin: autotools

When I run the snapcraft command, I get the following output:

Launching a VM.
Build environment is in unknown state, cleaning first.
info failed: The following errors occurred:
instance "snapcraft-hello" does not exist
launch failed: Unable to find an image matching "core18". Please use `multipass find` for supported remotes and images.
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.

When I run multipass find I get:

Image                       Aliases           Version          Description
18.04                       bionic            20211021         Ubuntu 18.04 LTS
20.04                       focal,lts         20211021         Ubuntu 20.04 LTS
21.04                       hirsute           20211025         Ubuntu 21.04
21.10                       impish            20211014         Ubuntu 21.10
daily:22.04                 devel,jammy       20211025         Ubuntu 22.04 LTS
anbox-cloud-appliance                         latest           Anbox Cloud Appliance
minikube                                      latest           minikube is local Kubernetes

Can someone please help me understand what I'm missing, and why it can't find Core18?

Cheers!

- Josh

Meng-Yuan Huang avatar
mx flag
It seems the core18 image is not availabe for arm64. If you run "multipass find" on a x86_64 host, it will list the core18 image!
Meng-Yuan Huang avatar
mx flag
To workaround this multipass limitation, please try to use lxd for build your snap on arm64 host by set the env variable first: export SNAPCRAFT_BUILD_ENVIRONMENT=lxd It works on Ubuntu arm64 with Parallels on Apple Silicon.
Score:0
za flag

I am not experienced at all with this snapcraft thing, so I am following the same tutorial as you.

I guess that this issue is because you didn't set "Allow Multipass" as stated in the tutorial, which means that the build environment is not being confined to a VM.

The first time you run snapcraft, you may be asked for permission to install Multipass. Snapcraft uses Multipass to both simplify the build process and to confine the build environment within a virtual machine. It offers the best build experience, so we highly recommend answering ‘y’. However, if you’d rather not use Multipass, you can also build natively, remotely, and with LXD. See Build options for details.

So I believe that snapcraft is trying to build for ubuntu Core, but you are building on a Ubuntu Desktop and multipass find cannot find the target device which your snap is trying to build to.

rj_code avatar
tn flag
I did press 'y' when prompted about Multipass.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.