Upgrading your LXD host (and OS)

Hi, I seek advice about howto upgrade my server to ubuntu lts 20.04. Currently it is on 16.04 with LXD 3.0.3-0ubuntu1~16.04.1 and zfs for container storage.

I did not find much info about LXD host upgrades on the net, probably due to the many options available.

My best option would be to perform a “do-release-upgrade” on the host, followed by upgrades of every single container with “lxc exec CONTAINERNAME – script /dev/null -c do-release-upgrade”. To my knowledge this is not the cleanest way because the size of the containers will grow dramatically in size, but it will be much more quick than start from scratch.

What is the best way to proceed?
• install snap and LXD 4.0 prior to OS upgrade? (or skip these steps?)
• make snapshots and export images form containers. (yes I need to do this :wink: )
• stop containers prior to actual OS upgrade? (or leave them running?)
• should the zpool be prepared prior to OS upgrade? (with zpool export or leave it active?)

any help is much appreciated, lxdblast

You can search in the forum:

I found this for example:
lxd.migrate

to complete the migration from deb to snap

Source: LXD Breaking After Upgrade From 16.04 to 18.04

Also this:
https://lxd.readthedocs.io/en/latest/migration/

Not so convenient.

Hello Toby, sorry to ask, perhaps I was not clear, I am aware of that howto, but my question is should I first do that or jump directly on the OS update? (in the assumption it will do the LXD update automatically for me)

I understand that you are asking for some hints in case you can avoid some trouble.
Either way should work, upgrade LXD then upgrade Ubuntu or the other way round.

Ubuntu 20.04 LTS has a deb package called lxd that is a special package that installs the LXD snap instead. Therefore, I would suggest to switch to the LXD snap first, before upgrading to 20.04.
Although it is meant to work (automatic migration), it is better to deal with one issue at a time than two, if something goes wrong.

Obviously, you should take backups of the containers. If you have some other server around, you can lxc copy to the other LXD server.

If you can, it would be better to stop the containers while upgrading the OS. Fewer moving parts is less complexity.

The Ubuntu kernels from 16.04 and newer have built-in ZFS support. I think that Ubuntu 14.04 was using DKMS. If you can verify this, then you can leave the zpool as is.

1 Like

Hi Simos, thank you for giving me some peace of mind. This info would be a pleasant addition in one of the general wiki’s.

I will follow your suggestions.

ZFS depends on a kernel module. I need to read a more about that, but even if my zfs fails I would have my container images as a backup. Sadly I have no spare server but I know how to publish/export my containers.