Host update from 16.04 to 18.04 - LXD tries to remove during dist-upgrade

Trying to upgrade from 16.04 to 18.04 on the host results in a requirement of running dist-upgrade. This left me with it wanting to remove LXD. See below. I’ve made a copy of the /var/lib/lxd/ directory which I assume will be a sufficient backup however this still makes me quite nervous. Should I go forward with this or is there a better option?

The following packages were automatically installed and are no longer required:
ebtables liblxc1 lxc-common squashfs-tools xdelta3
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
lxd
The following packages will be upgraded:
lxd-client
1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.

This should not be happening.

What command did you run exactly which is showing you this?

sudo do-release-upgrade
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

sudo apt-get upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages have been kept back:
lxd lxd-client
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

sudo apt-get dist-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages were automatically installed and are no longer required:
ebtables liblxc1 lxc-common squashfs-tools xdelta3
Use ‘sudo apt autoremove’ to remove them.
The following packages will be REMOVED:
lxd
The following packages will be upgraded:
lxd-client
1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 3,027 kB of archives.
After this operation, 12.1 MB disk space will be freed.
Do you want to continue? [Y/n] n
Abort.

Ok, can you run sudo apt install lxd lxd-client to force apt’s hand into having both installed and see what it does.

sudo apt install lxd lxd-client
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
lxd : Depends: liblxc1 (>= 3.0.0~) but 2.0.11-0ubuntu1~16.04.3 is to be installed
E: Unable to correct problems, you have held broken packages.

dpkg -l | grep lxd

Sounds like backports may have been involved somehow.

dpkg -l | grep lxd
ii lxd 2.21-0ubuntu3~16.04.2 amd64 Container hypervisor based on LXC - daemon
ii lxd-client 2.21-0ubuntu3~16.04.2 amd64 Container hypervisor based on LXC - client

Oh wow, that’s a weird version to be running.

Ok, so let’s try to update that first then:

sudo apt-get install -t xenial-backports lxd lxd-client

That “should” get you onto 3.0.3.

Before I do that, was my backup sufficient? Should I worry about losing containers?

The following additional packages will be installed:
liblxc-common liblxc1 libuv1
Suggested packages:
criu lxd-tools
The following packages will be REMOVED:
lxc-common
The following NEW packages will be installed:
liblxc-common libuv1
The following packages will be upgraded:
liblxc1 lxd lxd-client
3 upgraded, 2 newly installed, 1 to remove and 2 not upgraded.

That looks good, lxc-common can go away safely.

Ok, that went well! All containers still show running. do-release-upgrade now takes fine. Am I okay to do that (from an LXD perspective)?

Yep, that should be fine, the version on 18.04 will be the same, so not expecting surprises there.

All is well!!! Thanks for the help. You are always so supportive!