Build ubuntu-image with private snaps

Hi all.

I have been creating my first snap. After Install ubuntu-core I can install manually this snap without problems and works fine. ( I push my snap in private mode in the snap-store) to install my private snap I use: snap install --private my-snap-demo

Now Im trying to create a ubuntu-core image with this snap (using a common model), but when run “ubuntu-image …” command show that snap dont exist, but yes exist.

This is my “model”

type: model
authority-id: aaaaaaaaaaaaaaaaaaaaaaaa
series: 16
brand-id: aaaaaaaaaaaaaaaaaaaaaaaa
model: base-model
architecture: amd64
base: core22
grade: dangerous
    default-channel: 22/stable
    id: UqFziVZDHLSyO3TqSWgNBoAdHbLI4dAH
    name: pc
    type: gadget
    default-channel: 22/stable
    id: pYVQrBcKmBa0mZ4CCN7ExT6jH8rY1hza
    name: pc-kernel
    type: kernel
    default-channel: latest/stable
    id: amcUKQILKXHHTlmSa7NMdnXSx02dNeeT
    name: core22
    type: base
    daemon: true
    default-channel: latest/stable
    id: PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4
    name: snapd
    type: snapd
    default-channel: 22/stable
    id: BPZbvWzvoMTrpec4goCXlckLe2IhfthK
    name: ubuntu-frame
    type: app
    default-channel: latest/stable
    id: 4kq2HqQwTNu0dg7j16zDGwve5YY6pUy9
    name: nvidia-core22
    type: app
    default-channel: latest/stable
    id: bbbbbbbbbbbbbbbbbb
    name: my-snap-demo
    type: app
timestamp: 2024-03-01T11:44:43+00:00
sign-key-sha3-384: xxxxxxxx-xxxxxxxx


user@user:$ ubuntu-image snap custom-model-assertion.model --validation=ignore -v

[0] prepare_image
Error: Error preparing image: cannot download snap "my-snap-demo": snap not found

But I can see and install this snap manually

user@user:$ snap info my-snap-demo
name:     my-snap-demo
summary:  my-snap-demo - dummy package (snap)
publisher: JTAN (jtan)
license:   unset
description: |
  This is a simple snap with basic configuration and custom information.
  this package is designed for demo purposes
snap-id: bbbbbbbbbbbbbbbbbbbbbb
  latest/stable:    1.0.0 2024-03-27 (20) 2MB -
  latest/candidate: 1.0.0 2024-03-27 (16) 3MB -
  latest/beta:      1.0.0 2024-03-25 (16) 3MB -
  latest/edge:      1.0.0 2024-04-04 (26) 2MB -

My checks:

  • im using public snap-store (not brand-store).
  • Im logued to snap-store and can see and download my private snaps.
  • I can manually install this private snap.
  • In the model y tested another public snap and works fine.
  • I installed this snap in ubuntu-desktop (manually) without problems.

My doubts:

  • All snaps must be public to create a ubuntu-core image ?
  • In “private” snaps I strictly need a brand store for my assertions. I saw the documentation but is not 100% clear for me
  • I dont know what am I doing wrong.

Tnx a lot!

I suspect that this is simply because ubuntu-image isn’t connecting to the store as ‘you’ but as root because you have to use sudo part way through. The root user won’t have the snap store credentials so won’t be able to see private snaps.

You may be able to solve this by putting the relevant credentials in the right place, or setting up an environment variable to do it.