Installing a private snap

If I’ve registered and published a private snap, should I, and collaborators, be able to snap install it?

 snap install <snap_name> --devmode --edge 
error: cannot install "<snap_name>": snap not found

My understanding is that a snap is either published or not, so I’m not quite sure of what a “published private snap” would be.

Perhaps I’m missing something, but perhaps that’s what the issue is about. If you publish a snap, it is public. If you don’t publish it, you need to refer to its revision explicitly, and it won’t be in edge.

Clearly I don’t understand private snaps. See below for more insightful comments.

We are looking into this.

 snapcraft help
[...]
  snapcraft [options] register <snap-name> [--private]
[...]

Similarly, when registering a name in the store, you get a choice of making it private:

IIUC, this is orthogonal to a snap being published, and thought that the snap would be available to me and collaborators when published private.

You can also make the snap private at any time:

There’s some snapcraft commands missing to do this, also it’s impossible to change once you registered, but before you published - I’ll file issues as appropriate.

2 Likes

I currently have private snaps on the store released to channels for which I had previously ran snapcraft register --private <snap-name>.

That said, I am not sure about the expectations for:

  • collaborators
  • changing state after the registration took place

Due to the fact that changing the state from the snapcraft cli is not available since it is not exposed in the store APIs (AFAIR) it probably isn’t a thoroughly tested feature.

Can you snap install your private snaps?

Yes, as long as you snap login

sergiusens@mirkwood:~$ sudo snap login
Email address: sergio.schvezov@canonical.com
Password of "sergio.schvezov@canonical.com": 
Two-factor code: XXXXXX
Login successful
sergiusens@mirkwood:~$ snap install $(snapcraft registered|grep private|cut -f1 -d\ |head -1)
my-private-snap 0.0 from 'sergiusens' installed

EDIT: it might not be clear now that I read this, but the grep is for the Visibility column from the snapcraft output, I just happen to have a snap with private in its name.

Update: we found a misconfiguration that was causing this problem for newly private snaps since the dashboard.snapcraft.io cutover (clearly we need a better test for this). That has been fixed and snap find --private foo is working, but we are now hitting a secondary problem for a subset of those when attempting to install.

Sorry for the inconvenience, we’ll continue working on the fix.

1 Like
  1. When trying to “snap install” a private free of charge snap it says strange thing:
error: cannot perform the following tasks:
- Download snap "<snap>" (4) from channel "stable" (Please buy <snap> before installing it.)
  1. “snap install” doesn’t accept “–private” flag.
  2. “snap find” works only with “–private” flag.
  3. “snap download” can’t find a snap and doesn’t accept “–private” flag.
    Very inconsistent behavior between different subcommands in the same CLI.
  1. is a recent bug (as discussed) and will be fixed soon

  2. vs 3) is the current decided design, there are arguably other approaches, as best I as can summarize it the reasoning goes like this

  3. snap install should do what asked without fuss unless there’s a reason

  4. “snap find” alone should only list stable/public snaps

  5. is counterintuitive but “snap install” / “snap download” use quite different code paths (snap install goes through the snapd daemon, snap download doesn’t) , it’s something we plan to fix but is some work to do it correctly and hasn’t been scheduled yet

1 Like

The store bug was fixed as part of this morning’s maintenance. You should be able to install your new private snap now.

1 Like

Yes, everything’s working now, thanks!

Hi. Newbie here.
I was following the hello world snap tutorial yesterday. I can publish and install a public snap but I don’t seem to be able to install a private snap.

(classic)jpm-dom2@localhost:~$ snap list
Name       Version        Rev   Developer  Notes
classic    16.04          26    canonical  devmode
core       16-2.30        3748  canonical  core
pc         16.04-0.8      9     canonical  gadget
pc-kernel  4.4.0-109.132  98    canonical  kernel
(classic)jpm-dom2@localhost:~$ snapcraft registered
Name            Since                 Visibility    Price    Notes
foo-12345       2018-01-18T18:05:00Z  private       -        -
hello-dom3      2018-01-18T17:29:21Z  public        -        -
hello-jpm1234   2018-01-18T23:28:01Z  public        -        -
hello-priv1234  2018-01-18T23:26:20Z  private       -        -
(classic)jpm-dom2@localhost:~$ snap install hello-jpm1234
hello-jpm1234 2.10 from 'snaps-dom2' installed
(classic)jpm-dom2@localhost:~$ snap install hello-priv1234
error: snap "hello-priv1234" not found
(classic)jpm-dom2@localhost:~$ 

I am logged in, as far as I can tell.

Would someone be kind enough to tell me how this is supposed to work?
Thanks in advance.

I suspect you’re logged in with snapcraft but not snap. Type snap whoami to find out.

Bingo!

After logging in via snapd installing works fine. Thank you!

Great to know! Thanks. Do I have to login for snapcraft and snapd for ubuntu-image to install private and public snaps?

Update: the command ubuntu-image failed with the same message, snap not found.