How to Migrate lxd from old 17.04 filesystem (snap) to fresh 18,04 install?

Hi Everyone!

I had a running lxd environment on ubuntu 17.04 (using snap). I botched an upgrade to 17.10 (on my way to 18.04) and decided to install a fresh 18.04 on new disks. I have the old 17.04 OS filesystem mounted in the new environment (/media/oldos). The main 17.04 storage pool for my containers are all on a separate btrfs disk system that is mounted in the new 18 environment. What would be the easiest path to get my containers back running on 18? As options I see:

1- copy the old lxd directory to new
2- lxd import old lxd.yaml s from each container
3- lxc import tarballs
4-?

Re 1, I tried: stopping lxd, cp -R /media/oldos/var/snap/lxd /var/lib/ ; re-starting lxd, but no luck.

I don’t think I’ve successfully told the new lxd where my btrfsstor pool is … I am worried about wiping it out with the wrong init options.

Thanks for any insights!

Sorry, should have done more research first - there are a few threads with hints:

  1. remove default ubuntu 18 lxd and lxd-client
  2. install snap version
  3. stop lxd
  4. mv var/snap/lxd /var/snap/lxd.bak
  5. cp the old /var/snap/lxd to new /var/snap/lxd
  6. start lxd

I can see and start containers … still have some issues, but I think its relating to my network setup (which I don’t recall at all how it was done in past).

HTH…

So my network is OK - can ping in and out fine. But the containers are still not working as they should: only a dozen or so services get started.
The issue seems to be relateid to ID mapping. The entire root filesystem of the containers is getting the Nobody:NoGroup ownership. I gather with permissions in such a mess, nothing can start properly.

So I resorted to importing tarballs to the new environment and it worked perfectly. This gave me the chance to see the proper permissions; the issue is that somehow I ended up with container rootfs’s on host being own by host root instead of 1000000. Chowning them to 1000000 allowed things to start properly. A little cleanup was needed in the home directories … but I was able to engineer that from the tarball recovery.

HTH …