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
Blockquote
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
apps:
rso2:
command: rso2
parts:
rso2:
plugin: go
source: .
go-importpath: rso2
plugs:
rso2-home:
interface: home
rso2-network:
interface: network
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
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 https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization. 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.