7

In DEB package, it is not possible to install an application in offline (in a computer which does not have any internet access). Because of the dependencies. In case of .snap, according to the OMG!Ubuntu, Snap packages can contain both application binary and any dependencies required for it to run.

Does it mean that, any .snap application can be installed in an offline pc (like the .dmg in MacOSX)? As there is no need to fetch any dependencies from the source.

  • What? Of course you can install .deb packages offline. – David Foerster May 16 '16 at 12:09
3

First of all, you can indeed install debs offline:

$ sudo dpkg -i <deb>

However, you're right in that it doesn't take into account the deb's dependencies-- you actually need to have the deb and all its dependencies available offline in order to successfully install it:

$ sudo dpkg -i <deb> <dependency1> <dependency2> ...

So yes, installing a snap offline is very easy, and all you need to have is that single snap (since as you know, it includes its dependencies):

$ sudo snap install path/to/snap
  • Is this still the case? When I try installing a locally-built copy of the hello_world snap on Ubuntu 16.04 behind our corporate firewall I get error: cannot install snap file: Get https://search.apps.ubuntu.com/api/v1/snaps/details/core?channel=stable&fields=anon_download_url%2Carchitecture%2Cchannel%2Cdownload_sha3_384%2Csummary%2Cdescription%2Cdeltas%2Cbinary_filesize%2Cdownload_url...%2Cconfinement: dial tcp 162.213.33.196:443: getsockopt: connection refused. It seems to be insisting on going online for something... – lane Apr 25 '17 at 8:53
  • Looks like it's trying to fetch the snap. What command exactly did you run? snap install hello-world? Or snap install /path/to/my/hello-world? – Kyle Apr 25 '17 at 14:40
  • You can also try using --dangerous, it may be checking the store for assertions. – Kyle Apr 25 '17 at 14:41
  • 1
    This was using sudo snap install --dangerous ./hello_2.10_amd64.snap – lane Apr 26 '17 at 6:52
6

It seems you first have to download and install the ubuntu-core snap before you can do offline installs for any other snaps. For me this worked:

Run the following commands on an online Ubuntu system:

snap download ubuntu-core
snap download somePackage

This will put the following files in your current directory:

ubuntu-core_1797.assert
ubuntu-core_1797.snap
somePackage.assert
somePackage.snap

Copy these files to the offline system, then install them (from the directory they were copied to):

sudo snap ack ubuntu-core_1797.assert
sudo snap install ubuntu-core_1797.snap
sudo snap ack somePackage.assert
sudo snap install somePackage.snap

This should solve the problem @lane had where it tried to connect to the internet while installing a local .snap file.

  • So I have found some snap packages still try to connect to the Internet while installing. For quake-shareware_5.snap it says "Ensure prerequistites for "quake-share" are available". This will timeout on an offline machine. – Seth Jun 15 '18 at 16:17
  • @Seth Check whether core.snap has been installed – artificerpi Jul 12 at 3:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.