I’m trying to install lxd with snap on ubuntu 16.04 server.
As the server has no internet acces, I’ve download the .assert and .snap using ‘snap download lxd’.
This gives me a .snap and .assert file:
lxd_8011.assert
lxd_8011.snap
After copying to the server, I would like to install it with:
$ sudo snap ack lxd_8011.assert
$ sudo snap install lxd_8011.snap
-- ensure prerequisites for "lxd" are available (get https://api.snapcraft.io/api/vs/snaps/details/core?channel=stable&fields=anon_dowload_url%2Carchitecture%2Cchannel%2Cdownload_sha4_384%2Csummary%2Cdescription%2Cdeltas%2Cbinary_fileize%2Cdownload_url%2Cepoch%2Cicon_url%2Clast_updated%2Cpackage_name%2Cprices%2Cpublisher%2Cratings_average%2Crevision%2Cscreenshot_urls%2Csnap_id%2Clicense%2Cbase%2Csupport_url%2Ccontact%2Ctitle%2Ccontent%2Cversion%2Corigin%2Cdeveloper_id%2Cprivate%2Cconfinement%2Cchannel_maps_list : dial tcp: lookup api.snapcraft.io on [::1]:53: read udp [::1]:53788 -> [::1]:53 read: connection refused)
Indicating to me that the snap tries to connect to the internet to find prerequisites. I’ve searched snap documentation, but I feel this is snap-specific.
tl;dr: Offline install isn’t working. Has this been tested for LXD?
I see, thank you for your fast reply.
Does your container have internet acces?
Because manual installation succeeds if I have internet acces, but fails otherwise:
$ lxc launch ubuntu:16.04 offline
Creating offline
Starting offline
$lxc exec offline -- sudo --login --user ubuntu
ubuntu@offline:~$ sudo snap download lxd
Fetching snap "lxd"
Fetching assertions for "lxd"
Install the snap with:
snap ack lxd_8011.assert
snap install lxd_8011.snap
ubuntu@offline:~$ sudo ifdown eth0
ubuntu@offline:~$ sudo snap ack lxd_8011.assert
ubuntu@offline:~$ sudo snap install lxd_8011.snap
error: cannot perform the following tasks:
- Ensure prerequisites for "lxd" are available (Post https://api.snapcraft.io/v2/snaps/refresh: dial tcp: lookup api.snapcraft.io on [::1]:53: read udp [::1]:37859->[::1]:53: read: connection refused)
ubuntu@offline:~$ sudo ifup eth0
ubuntu@offline:~$ sudo snap install lxd_8011.snap
ubuntu@offline:~$ sudo snap download lxd
2018-08-01T14:07:42Z INFO Waiting for restart...
lxd 3.3 from 'canonical' installed
So with working network it’s fine, without it fails.
When you perform the snap install of the .snap package, it indeed tries to connect to api.snapcraft.io to perform a POST to https://api.snapcraft.io/v2/snaps/refresh.
The snap install validity check should be fine because of the snap ack lxd*.assert. Other snaps do install offline, so I figured it might be the way the lxd snap is set up. I will check with the snapcraft forum, and if any answers come up I’ll post them here as well.
After removing the snap that was succesfully installed, it would reinstall offline. The ‘core’ snap was missing. (although i had manually installed the ubuntu-core snap, as suggested by snap documentation.)