The snapcraft package is not being created

A couple of days ago I created snap packages without any problems
Now when I try to execute the snapcraft command, I get the following error
Issues while validating snapcraft.yaml: must be one of base: and type: <app|gadget>, base: bare (with a build-base), or type: <base|kernel|snapd> (without a base)
I tried to fix this error by adding snapcraft to the file.yaml string base: core 20
Then I got the following error
Build environment is in unknown state, cleaning first.
info failed: The following errors occurred:
instance “snapcraft-rso2” does not exist
launch failed: CPU does not support KVM extensions.
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.
Here is my test package

name: rso2
base: core20
summary: A simple Hello World program.
description: |
A simple Hello World program written in Go.
Packaged as a Snap application using Snapcraft.
version: ‘1.0’
confinement: strict
command: rso2
plugin: go
source: .
go-importpath: rso2
interface: home
interface: network

How can I solve this problem?

It sounds as though the multipass VM being used is in a weird state. Try deleting it:

multipass delete --purge snapcraft-rso2

And try snapcraft again.

I tried to execute it and received the following message

delete failed: The following errors occurred:
instance “snapcraft-rso2” does not exist

Sorry, I read more closely multipass can’t create the VM: launch failed: CPU does not support KVM extensions.

I’m not sure why the CPU support would have changed. @Saviq any ideas?

I created the package literally two days ago without any problems, and the next day these errors appeared

did you change or reset your BIOS/UEFI settings since ?
KVM support is usually en/disabled only there …

No, I did not reset the BIOS settings
Ubuntu is on Hyper-V

I put Ubuntu on Virtualbox
I tried to create a Snap package, but I get the same error
I went to the BIOS settings KVM is enabled

you could fall back to use lxd containers instead of multipass VMs …

$ sudo snap install lxd
$ sudo lxd init # hit enter for all questions
$ snapcraft --use-lxd

This didn’t solve my problem I still can’t create a package

whats the error ?

Previously, when creating a package, it was not necessary to specify “base”, but now if you do not specify it, the system gives an error
The documentation says that this parameter is not required

check this, there is some help from “simos” in that thread that might help you to keep going:

The problem stems from snapcraft updating and removing deprecated code that you were relying upon. The deprecated code was used when base is not specified and is very old behaviour from circa 2016/2017. That code path built on your host system, not inside a virtual machine or lxd container. Now that code has been removed and base is required you will be using the new mechanisms that default to building inside multipass virtual machines, or with --use-lxd inside an lxd container.

As you are running your build system inside hyper-v you need to ensure that the vm is configured for nested-virtualisation to use multipass virtual machines for your build. See the microsoft docs here LXD does not require this, however, so you might prefer that. Alternatively you can continue building on your host system (provided that your host be an Ubuntu 16.04 to build a base: core or Ubuntu 18.04 for base: core18 or Ubuntu 20.04 for base: core20) by exporting the environment variable SNAPCRAFT_BUILD_ENVIRONMENT=host or by passing --provider=host on the command line.

1 Like

Can you tell me how to properly configure the LXD

I managed to configure LXD, the package was built, but at the end I got the following error

You should probably try restarting the lxd container with snapcraft clean && snapcraft --use-lxd

1 Like

you need to call snapcraft clean --use-lxd or it’ll be trying to clean a VM instead of the LXD container. i.e. it needs --use-lxd.

1 Like