Cannot download snap file

I am trying to create an image with ubuntu-image and the process fails when trying to download from the public store a private devmode snap, saying

error: cannot download snap "iris-incuvers": snap not found

I am logged in and can snap info correctly, I’m targeting the edge channel. Since the snap I need is built for ARM64 and ubuntu-image is running on AMD64, I make sure to set the UBUNTU_STORE_ARCH=arm64 environment variable.

I can try to install the snap (from an ARM64 host) and I actually see the download progress, but a pure download operation setill fails. The snap confinement is still in devmode, and as I understand do not appear in search results, does it also prevent snap download ?

Don’t do that …
The architecture is defined in your model assertion, ubuntu-image knows exactly what to do to get the binaries for the target arch, just let it do its job, there is no need to set the STORE_ARCH for it…

are you able to publish your model assertion so we can see if there is anything wrong in the snap list definitions ?

Yes of course.

    "type": "model",
    "series": "16",
    "authority-id": "BZn14KGiwBc3TVYC0rgBvDtkHrbYbspY",
    "brand-id": "BZn14KGiwBc3TVYC0rgBvDtkHrbYbspY",
    "model": "iris",
    "architecture": "arm64",
    "timestamp": "<TIMESTAMP>",
    "base": "core20",
    "grade": "dangerous",
    "snaps": [
            "name": "pi-iris",
            "type": "gadget"
            "name": "iris-incuvers",
            "type": "app",
            "default-channel": "latest/edge",
            "id": "JsYa4C4zXTON8ycQXgRZVtgBol21swB6"
            "name": "pi-kernel",
            "type": "kernel",
            "default-channel": "20/stable",
            "id": "jeIuP6tfFrvAdic8DMWqHmoaoukAPNbJ"
            "name": "core20",
            "type": "base",
            "default-channel": "latest/stable",
            "id": "DLqre5XGLbDqg9jPtiAhRRjDuPVa5X1q"
            "name": "snapd",
            "type": "snapd",
            "default-channel": "latest/stable",
            "id": "PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4"

For context: I’m still exploring the snap process and plan to eventually bring our snaps in a properly confined state. I’m playing around with image making at the moment to make sure I understand the pipeline all the way to deployment (before requesting a brand store).

I inject a date and create a signed model via a script.
I use the --snap pi-iris_20-1_arm64.snap arguments to add the gadget from a file (build on ARM64):
ubuntu-image snap --snap pi-iris_20-1_arm64.snap iris-model.model
The problem arises while trying to download iris-incuvers (which is a devmode ARM64 private snap on the edge channel of the ubuntu store).

This looks all fine, my guess is that ubutu-image can simply not see the snap because it is private (though perhaps @ijohnson has any other idea) … what you can do is to pre-download the snap and simply use a second --snap argument for it to have it locally installed …

ubuntu-image does not use the login info of snap from your host, the ubuntu-image snap ships it’s own version of the snap command, and even then it uses the snap download command which does not use the login credentials of snap info.

What you can do is define the UBUNTU_STORE_AUTH_DATA_FILENAME env var to point to a file that you create with snapcraft export-login ... with appropriate access granted to the macaroon created by snapcraft.

Oh, great it’s downloading right now! Thanks, you two unblocked me once again.

1 Like

dear all,

I have a similar issue:

specifying the following in the .json file

  "type": "model",
  "series": "16",
  "model": "pro2-iot",
  "architecture": "armhf",
  "authority-id": "mycompany",
  "brand-id": "mycompany",
  "store": ".......",
  "timestamp": "2022-04-04T10:40:41+00:00",
  "base": "core22",
  "grade": "dangerous",
  "snaps": [
     "name": "pi",
     "type": "gadget",
     "default-channel": "22/stable",
     "id": "YbGa9O3dAXl88YLI6Y1bGG74pwBxZyKg"

I do not have the command

UBUNTU_STORE_ARCH=armhf UBUNTU_STORE_ID=.......... UBUNTU_STORE_AUTH_DATA_FILENAME=./store.auth ubuntu-image snap -c stable -O ./build --cloud-init ./conf/pro2-iot/cloud-init-pro2-iot.conf ./conf/pro2-iot/pro2-iot.model

download the pi snap; the output is like the following

WARNING: proceeding to download snaps ignoring validations, this default will change in the future. For now use --validation=enforce for validations to be taken into account, pass instead --validation=ignore to preserve current behavior going forward
error: cannot download snap "pi": snap not found

but if I use the manual command

UBUNTU_STORE_ARCH=armhf snap download pi --channel=22/stable

I get it downloaded:

Fetching snap "pi"
Fetching assertions for "pi"
Install the snap with:
snap ack pi_133.assert
snap install pi_133.snap

a workaround could be that of copying the manually downloaded snap to the custom_snaps directory and instruct ubuntu-image to use it but I wonder why it is not automatically downloaded through the info in the .json file

any idea?

Does the picked store above actually contain the snap ?

it seems to me that the picked store contains only my proprietary snaps so the answer is no; but in the .json file I have other public snaps (like pi-kernel, core22, core18, snapd) that are not listed in my store space and those are downloaded; the only that is not downloaded via ubuntu-image is the pi gadget snap