Download snap package

I would like to download without installing a snap package from the snapcraft store, so the equivalent of snap download <package_name>…I don’t see how to do it.
is it possible to do it using the snapcraft store ?
ps: I hope this is the right place to ask this, otherwise I apologize

You had it right, it’s snap download <snap name>

Like this:

asciicast

yeah, but I want to download the snap from a browser using the snapcraft store (or whatever snap store on the web)

That’s not quite so straightforward. We don’t make it obvious how to download and install snaps directly from the store, because there’s a bunch of downsides to doing it. We do however have a store API which gives you the URL of the snap file, should you want to.

For example:

https://search.apps.ubuntu.com/api/v1/package/firefox

Contains a field called “download_url” which in this case is https://api.snapcraft.io/api/v1/snaps/download/3wdHCAVyZEmYsCMFDE9qt92UV8rC8Wdk_280.snap which is the Firefox snap revision 280 which is currently in the stable channel.

You could wget that.

2 Likes

may I ask, out of curiosity, why you want to do that?

I have two device: one with internet access but without snapd (android) and one without internet access but with snapd… I would like to take from internet the snap and try it on my isolated computer…sometime ago I used uApp Explorer but now it has shutdown and there is not a store that seems to give the same feature.

@popey sorry but I don’t get that…we have a store that through a terminal permit with a simple command to download the snap file; why give that same possibility through an easy interface in an official “webstore” should introduce issues? imho it should be an (informed) user choice… for my POV it is better to easily permit to download the file with appropriate warning about the downsides rather than simply hide that possibility or relegate it to the use through terminal (in the last two case actually it is without warnings)

Can you not tether the computer to the Android device to provide internet to it?

The reasons are many. For example snap download does more than just download the snap. It also downloads an assertion file. So you’d typically snap download foo snap ack foo.assrt then snap install foo.snap. The assertion file tells snapd what a bunch about the snap such as what interfaces should be automatically connected.

Snaps also have connections to other snaps so doing snap download firefox isn’t enough, you may also need core or core18 snaps. Some others such as KDE snaps require other snaps which contain common libraries and/or themes.

If you download from the web, you’ll need to download a bunch of snaps, and the assert files. Not just one file. It would be quite a messy and potentially error-prone process.

We optimised the process of installing snaps for machines which have an internet connection, at least periodically. The use case of having a second computing device - which isn’t even able to run snap download isn’t a use-case we’ve optimised for, which is partly why it’s not easy / possible to get the snap from the web.

To my recollection you’re asking for a feature which we pretty much never get asked for. We try not to engineer for edge cases, but for the common case.

1 Like

thank you for the interesting explanation and thank you for the download instruction above.

the disconnected computer is in an area without internet and mobile connections so I have to use my smartphone to take the software and then put it on the computer…I hope this is momentary.

I didn’t know anything about the connections to other snap. my last information about this was that snaps come with all libraries included so no more external dependence :thinking:
so, if I understand correctly what you said, snapd tell the snapstore my computer configuration and installed snaps and through this is generated an assertion file that tell my snapd what else snaps are needed and how to install them, is it right?
why the instructions about the interfaces needed by the snap don’t come inside the snap itself and need a communication with my snapd ?

Applications do come with the libraries necessary in general. However we also have a concept of ‘content snaps’ which enable snaps to share programs and data.

The snap doesn’t contain the assertion because the snap comes from a snap publisher, unmodified. The assertion comes from the store.

1 Like

thx! That is very interesting because many comment online still says that flatpak, unlike snaps, having shared framework reduce the duplicates library. so from now on I can redirect them to the “content snaps” topic.

But now I’m wondering why can’t that assertion file be generated from snapd, localy, but only from the store? what are the data needed for the assertion file generation?

the assertion is a gpg signature file, snapd has the public part of this gpg key builtin, so it can verify every package that has been signed by this particular gpg key …

the secret part of this key lives in the snap store and only there. to sign the snap it needs to be processed by the store to extract the metadata and sign it with the key, this becomes the assertion file.

when installing a snap snapd verifies the signature (that it was uploaded to the store also means it passed an automatic security review that checks the permissions (interfaces) a snap uses) and marks the snap as valid.

you can circumvent that signature check (for “sideloading” local snaps when developing etc) by using the --dangerous switch to the snap install command …

Can’t this be inside the snap when you “manual” download it? And then when you snap install myLocalSnap.snap it auto checks for assertion file and then installs it?
Double clicking an snap for installation or just CLI only one file would be way easier

No, because by policy we don’t modify the snap published by the developer.

2 Likes