Need help with snap install - Unable to talk to LXD

All:

I’m trying to migrate from the ppa to snap on Ubuntu artful. After installing the snap, running lxd init results in the following error: “error: Unable to talk to LXD: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: no such file or directory”

Performing a snap logs lxd shows the following:

2017-12-03T21:28:16Z lxd.daemon[30037]: /snap/lxd/5061/wrappers/daemon.start: 21: .: Can't open /var/snap/lxd/common/config
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Unit entered failed state.
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Failed with result 'exit-code'.
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Service hold-off time over, scheduling restart.
2017-12-03T21:28:16Z systemd[1]: Stopped Service for snap application lxd.daemon.
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Start request repeated too quickly.
2017-12-03T21:28:16Z systemd[1]: Failed to start Service for snap application lxd.daemon.
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Unit entered failed state.
2017-12-03T21:28:16Z systemd[1]: snap.lxd.daemon.service: Failed with result 'exit-code'.

Any help would be appreciated.

-steve

Followup…

I got it to work but it required a full manual cleanup as follows:

  • sudo apt-get remove --purge snapd
  • sudo rm -rf /snap
  • sudo rm -rf /var/snap
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/default/containers
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/default/snapshots
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/default/custom
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/default/images
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/default
  • sudo btrfs subvolume delete lxd/common/lxd/storage-pools/
  • rm -vf /etc/systemd/snap-*.mount
  • rm -vf /etc/systemd/snap-*.service

followed by a reinstall of both snapd and the lxd snap.

Not sure how much of the above was necessary, but it did the trick.

Two notes:

  • Does snap not contain a command analogous to apt-get install --reinstall?
  • My PATH variable was not update to include /snap/bin

-steve

I’m not aware of a way to have snapd reinstall a snap without having it removed (which would cause all data be lost).

For the PATH issue, the snapd package installs a bashrc hook but this requires you to re-spawn your shell, usually by logging out and back in.

Regards reinstalling a snap, the inability to reinstall - or force reinstall - meant I lost the data in any case (fortunately it was a development machine) I just had a lot more investigative work to figure out what to clean out.

While I understand the move to snaps, the fact that there is no real means - that I know of - of fixing a corrupted snap gives me pause about going to snaps for production/important machines.

Regards, the PATH, I imagine the problem is that I use zsh and so the hook didn’t do anything. It might be worthwhile specifying in the documentation that /snap/bin needs to be on the path. Not being familiar with snap it took me some googling to figure out where the binaries were.

Cheers,

-steve

All the data from the snap is accessible through /var/snap/lxd (mostly in /var/snap/lxd/common/lxd). If necessary, this can be manually backed up and restored as was /var/lib/lxd with the deb.

The snap content itself is in /snap/lxd/current/ and we have a number of snap set options to tweak the behavior of the snap (see LXD snap: Call for testing).

We also have a mechanism in place to sideload a manually built/debug lxd binary onto a snap install, so that we can distribute emergency fixes or capture extra debug information.