LXD is a container hypervisor/lighter-visor for Linux distributions. You kinda get the effect of a Linux virtual machine but using Linux containers instead. You can consider them as lightweight virtual machines.
Currently, LXD is at version 2 (2.21) and soonish version 3.0 will be released. In this post we see how to get to try this beta version of LXD early. Standard disclaimer applies: do not try on production unless you are properly prepared.
For this to work, you need to have migrated to the snap version of LXD. See below on how to do that,
Check to see the available versions of the snap package of LXD. You want to identify your current version of LXD, and the versions that are available in the channels.
$ snap info lxd name: lxd summary: System container manager and API publisher: canonical contact: https://github.com/lxc/lxd/issues license: unknown description: | LXD is a container manager for system containers. It offers a REST API to remotely manage containers over the network, using an image based workflow and with support for live migration. Images are available for all Ubuntu releases and architectures as well as for a wide number of other Linux distributions. LXD containers are lightweight, secure by default and a great alternative to virtual machines. snap-id: J60k4JY0HppjwOjW8dZdYc8obXKxujRu commands: - lxd.benchmark - lxd.check-kernel - lxd.database - lxd.lxc - lxd - lxd.migrate services: lxd.daemon: simple, enabled, active tracking: stable installed: 2.21 (5866) 49MB - refreshed: 2018-02-19 06:45:15 +0000 BST channels: stable: 2.21 (5866) 49MB - candidate: 2.21 (6005) 51MB - beta: 3.0.0.beta6 (6182) 55MB - edge: git-fc8e7bf (6211) 55MB - 2.0/stable: 2.0.11 (5384) 21MB - 2.0/candidate: 2.0.11 (5384) 21MB - 2.0/beta: ↑ 2.0/edge: git-d71807e (6069) 20MB -
In tracking, it says stable. This means that we are tracking the stable channel which is shown next.
The installed version is LXD 2.21, which is the currently stable version. It has an internal incremental ID of 5866. This incremental ID is important when you compare with the candidate channel. The candidate channel has a snap package of LXD with incremental ID 6005, which is newer and probably has some fixes. The snap package in the candidate channel will probably get promoted to the stable channel at some point. You as a user will then receive the update automatically within the day that the new version becomes available in the stable channel.
The beta channel has a 3.0.0.beta6 version and this is the version that we will be getting. The version in the beta channel gets promoted to the candidate channel and stays there for a bit, and then it gets promoted to the stable channel for an automatic upgrade.
The edge channel has an autogenerated version that was freshly compiled from the source code at the LXD git repository. These are automatically compiled and uploaded every day. The git-fc8e7bf in the version indicates the last git commit of the source code, and helps to figure out the snapshot of the source that was used to create the snap. The fc8e7bf in git-fc8e7bf indicates the exact commit, and you can find it by perusing the commits at https://github.com/lxc/lxd/commits/master. Here is the exact commit on Github,
Switching to channel beta
With snaps, you can switch channel using the switch subcommand. When switching channel, nothing happens (no snaps are changed immediately) and you have to use the refresh subcommand to actuate the change.
$ snap switch --channel=beta lxd "lxd" switched to the "beta" channel
You switched channel and you are now tracking the beta channel. This is reflected in the following,
$ snap info lxd name: lxd summary: System container manager and API publisher: canonical ... tracking: beta installed: 2.21 (5866) 49MB - refreshed: 2018-02-19 06:45:15 +0000 BST ...
Refresh the snap packages in order to actuate the channel switch.
$ snap refresh lxd (beta) 3.0.0.beta6 from 'canonical' refreshed
This takes a bit to complete because it downloads the new snap package and then performs the upgrade from LXD 2.x to LXD 3.x. snap info reflects the change.
$ snap info lxd name: lxd summary: System container manager and API publisher: canonical ... tracking: beta installed: 3.0.0.beta6 (6182) 55MB - ...
And that’s it. Now look into your containers and try to figure out if something is not working as expected. There are quite some new things in LXD 3.0, and will be the subject of new posts.
Help! How do I downgrade back to LXD 2.0?
Normally, downgrading through major versions is not supported. I have not tried whether in practice it would work (for example, partially), therefore I do not know if it will work. Often in new versions of LXD there are changes in the SQLite schema, and those are likely to be the first problem you would encounter. That is, an older LXD version would not recognize changes introduced by the newer version of LXD.
I would not recommend to downgrade but you may do so for science and report here in a comment!
Help! “snap install –beta lxd” does not work!
Here is what I tried:
$ snap install --beta lxd snap "lxd" is already installed, see "snap refresh --help"
snap install is needed only when you are first installing a snap. And when you first install a snap, you can specify the channel and go straight to the channel of your choice.
Help! Can I switch channel with “snap refresh“?
The original way to switch snap channel was to use snap refresh, with the appropriate parameters.
Here is how you do it. You use the refresh subcommand, and specify the new channel.
$ snap refresh --channel=beta lxd lxd (beta) 3.0.0.beta6 from 'canonical' refreshed
The difference between snap refresh –channel and snap switch/snap refresh is that in the first, the change is effected at once. In the second, it is a two-stage process.