Migration from LXD 3 to Incus

Hi all, perhaps this has been asked over and over, but I could not find the right topic.

I’m currently running an old Ubuntu 18.04 with LXD 3.0.3 (ZFS storage backend) that I would like to update to newer Ubuntu. So my plan is to install Ubuntu 24.04 and Incus (and BTRFS storage backend) on a new server and then migrate from the old to the new.

When the new server is set up with Incus, can I just set it up as a remote on the old LXD instance and just do lxc copy containername new-remote:containername?
Or from the other way, set up the old server as a remote on the new and then from the new server do incus copy old-remote:containername containername?

Thanks in advance!
/Anders

That should be fine, though authentication works a bit differently between both releases and you’ll in general be better served by using a newer client tool, so I’d probably recommend using the incus tool to handle the copy.

I think the rough plan should be:

  1. Ensure that both source and target are listening on the network (core.https_address is set)
  2. Make sure that you have a client certificate on the target server by running incus remote generate-certificate
  3. Copy ~/.config/incus/client.crt to the source server that’s running LXD
  4. Run lxc config trust add client.crt on that system
  5. Make sure you don’t have a trust password on the old system by running lxc config unset core.trust_password
  6. Run incus remote add old-lxd IP-ADDRESS on the target Incus server
  7. Confirm that things work by doing incus list old-lxd:
  8. Try an instance copy with incus copy old-lxd:NAME local:

If you get some weird error in that last stage, try running it again with --mode=relay, but I’m not sure that LXD 3.0 supports relay mode…

2 Likes

Wow! That’s all it takes for a live migration! This is mind-boggling to me. Thank you.

It’s likely that the instances are from a very old version of Ubuntu runtime, which means that there may be no more new updates, and the PHP/MySQL services are stuck to some old and unsupported 5.x version. Personally, given the choice, I’ld export any data and reinstall the services in new and fresh Incus instances.

Actaully the container instances are well-maintained and running newer rootfs. But when trying to upgrade the host, LXD had switched to snaps and there was many issues, I rather do one container at the time than having all the chaos at once.

I’ve finally gotten around to start the migration and followed your instructions @stgraber , however, on step 6 when adding the remote on the incus server I get the following error:

arune@server21:~$ incus remote add old-lxd 192.168.4.20
Error: Get "https://192.168.4.20:8443": remote error: tls: handshake failure

Could the old LXD be too old?

Solved “remote error: tls: handshake failure” when adding the remote by having the INCUS_INSECURE_TLS set to true.

But the last two steps did not work well.

arune@server21:~$ incus list old-lxd:
Error: The server is missing the required "api_filtering" API extension
arune@server21:~$ incus copy old-lxd:xwiki local:
Error: not found

Should I install a machine with 20.04 and whatever version of LXD that comes with it, migrate here and then to incus?

I did manually export a container:

lxc snapshot CONTAINERNAME snapshot-for-migration
lxc publish CONTAINERNAME/snapshot-for-migration --alias migration-image
lxc image export migration-image /tmp/container-migration

This created an image /tmp/container-migration.tar.gz which I SCPed to the new server and imported like this:

incus image import container-migration.tar.gz --alias CONTAINERNAME-import
incus launch CONTAINERNAME-import CONTAINERNAME

Not great but ok :slight_smile:

Thanks for sharing the steps. Question - Will the container retain its original IP address after migration ?

@Student No. Maybe possible, but not by default.

1 Like