How to use core16 as base snap?

I got an error when trying to set base: core16

Failed to install or refresh a snap: 'core16' does not exist or is not available on the desired channel 'latest/stable'. Use `snap info core16` to get a list of channels the snap is available on.

Is it possible to use it for now?

Don’t specify the base in your snap yaml and it will automatically build as 16.

Also, the core16 is actually just called ‘core’.

core16 is distinct from core: it is built like core18 is without an included copy of snapd and associated tools (instead having them provided by the snapd snap).

I think the main problem here is that nothing has been published in the stable channel for core16 yet, likely because it is not yet stable. I’m not sure if Snapcraft has a way to build snaps against an unstable base. It seems like you should be able to enable it some how though: if only for the benefit of people developing base snaps.

1 Like

Checking the snap info the two snaps are actually different:

name:      core
summary:   snapd runtime environment
publisher: Canonical*
contact:   snaps@canonical.com
license:   unset
description: |
  The core runtime environment for snapd
type:         core
snap-id:      99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking:     stable
refresh-date: 4 days ago, at 11:06 CST
channels:
  stable:    16-2.37.2                 2019-02-14 (6405) 95MB -
  candidate: 16-2.37.2                 2019-02-12 (6405) 95MB -
  beta:      16-2.37.3                 2019-02-19 (6479) 95MB -
  edge:      16-2.37.2+git1149.db8c95c 2019-02-19 (6469) 93MB -
installed:   16-2.37.2                            (6405) 95MB core
name:      core16
summary:   core16 runtime environment
publisher: Canonical*
license:   unset
description: |
  The core16 runtime environment
type:    base
snap-id: lVwne2LSLAKRqY5zZV7Q3is2kJYfZhCS
channels:
  stable:    --                               
  candidate: --                               
  beta:      16-20190110 2019-01-10 (46) 74MB -
  edge:      16-20190110 2019-01-10 (46) 74MB -

I’m not sure if Snapcraft has a way to build snaps against an unstable base.

I’ve just built an snap against core16. But I can’t release it as stable since if I change the grade to stable I get the error message (during the priming stage):

Snap 'grade' was set to 'stable' but must be 'devel'.
Recommended resolution:
Set 'grade' to 'devel' or use a stable base for this snap.

I can link to the source code later, but here is the snapcraft.yaml:

name: mg-thibran
version: 'master'
summary: OpenBSD micro Emacs clone
description: |
  mg is intended to be a small, fast, and portable editor for
  people who can't (or don't want to) run emacs for one reason
  or another, or are not familiar with the vi editor. It is
  compatible with emacs because there shouldn't be any reason to
  learn more editor types than emacs or vi.

  https://man.openbsd.org/mg.1

grade: devel          # stable devel
confinement: strict    # strict devmode
base: core16

version-script: |
  cd parts/mg/src
  echo $(git rev-parse HEAD | cut -c1-7)

apps:
  mg:
    command: bin/mg
    plugs: [home]

parts:
  mg:
    plugin: make
    source: "https://github.com/hboetes/mg.git"
    source-depth: 1
    make-parameters: ["STATIC=yesplease"]
    build-packages:
      - libbsd-dev
      - libncurses5-dev
      - pkg-config
      - gcc
    organize:
      usr/local/bin/mg: bin/mg
      usr/local/man/man1/mg.1: usr/share/man/man1/mg.1
    stage:
      - -usr/local

If you want to build a snap against an Ubuntu 16.04-like environment, just use base: core. With that said, I’d strongly recommend looking at core18 or core20 for new work.

2 Likes

FYI, it’s forcing grade “devel” because core16 is not available in the stable channel. That message could be improved a bit. Use core, or better yet, as jamesh said core18 or core20 if possible.