Monday, 20 August 2018

Transition of LXD from deb to snap


As some of you may know, we've slowly been pushing LXD users to use the
snap rather than the deb, whenever their environment allows it.

Starting with Ubuntu 18.10, we will be replacing the deb package
traditionally shipped in Ubuntu by the LXD snap.

There are a few pieces to that migration so I'll go into details about
each of them:

== Dependency management ==
LXD currently has the following reverse dependencies:

- adapt (depends)
- nova-compute-lxd (depends)
- autopkgtest (suggests)
- snapcraft (suggests)

We'll make sure that each of those are capable of handling the LXD snap.

That typically means either using the command line tool directly or if
using the API, looking at both /var/lib/lxd/unix.socket and

We will keep a deb in the archive, which will provide the "lxd" binary
package and act as a shim which installs the snap and proceeds with data
migration if required.

== Data migration ==
The LXD snap ships with a "lxd.migrate" command which handles moving of
all data from the deb path (/var/lib/lxd) over to the snap path

The package in its preinst will attempt to contact the snap store,
holding package upgrade until it's reachable, then ask the user about
what track they'd like to use, followed by installing the LXD snap,
waiting for it to be online and automatically run the migration tool.

Should any error happen, the deb content will remain on disk (as all
this is done in preinst). We can then provide individual instructions
for failed migrations and update lxd.migrate to account for any cases
that it couldn't handled.

== Seed management ==
LXD is currently seeded in the server seed, making it included in all
Ubuntu Server installations, including cloud images.

We expect that this will continue to happen and have landed experimental
socket activation support in our edge snap to allow for this (as always
running LXD in all cloud instances is obviously unacceptable).

The main blocker we have right now is that snapd socket activation is
misbheaving on Fedora, making it impractical for us to enable socket
activation in the stable channel.

If we don't have a resolution on the Fedora side within a couple of
weeks, I expect we'll temporarily unseed LXD from Ubuntu so we can move
forward with the rest of the plan, then seed LXD as a snap as soon as
socket activation works properly for all our users.

== Channels and tracks ==
LXD has a track per upstream LTS release as well as a "latest" track.

The current plan is to have Ubuntu LTS releases default to installing
from the most recent LTS track (currently "3.0") while non-LTS Ubuntu
releases should default to installing from the "latest" track.

The debconf prompt will always be shown, so this will only affect the
default selection.

A branch of the stable channel of those tracks will be created and
closed per policy on seeded snaps (allowing to push emergency snaps to
those users bypassing the upstream).

== LXD in the LTSes ==
Nothing is going to change for LXD in existing Ubuntu releases.

We'll keep maintaining those debs in both -updates and -backports until
such time as the Ubuntu release becomes EOL.

This change applies ONLY to Ubuntu 18.10 and later.

== Timeline ==
I was hoping to have all of this done prior to Feature Freeze, but it's
clear that this will not happen.

The current plan is to have the reverse dependencies and remaining
socket activation problems sorted within the next 2 weeks, at which
point we can upload the migration deb to the archive and transition the
seeds to pointing to the snap.

This should still provide with plenty of time to deal with any issue
that shows up and Ubuntu 18.10 feels like the right time to do this work
so we can be very confident that the 18.04 to 20.04 upgrade will go
smoothly down the line.

== How to help ==
We have a Launchpad bug open to track the reverse dependencies part of
this here:

And have a PPA which contains the current version of the upgrade deb here:


If you're running downstream software which interacts with LXD, I'd
strongly recommend you try switching to the snap, either using the
package in that PPA or manually by installing the LXD snap and then
running "lxd.migrate".

Should you have any questions or issues, feel free to respond here or
contact me directly on IRC or by e-mail.

Stéphane Graber
Ubuntu developer