I have a dual boot system using Gentoo and Ubuntu (Bionic). They share the ZFS filesystem. The lxd version in gentoo usually lags behind upstream. What is the best way to share containers between the two?
At the moment, i am using ‘btrfs’ backend in Gentoo (lxd is not setup in Ubuntu). How can i migrate the existing containers to ZFS dataset rpool/lxd?
I was able to migrate the containers into the ZFS filesystem. The containers start fine on Ubuntu, however lxd crashes right away on Gentoo.
Log file says,
Mar 30 06:53:07 box /etc/init.d/lxd[17493]: You have to create an init script for each container:
Mar 30 06:53:07 box /etc/init.d/lxd[17495]: ln -s lxc /etc/init.d/lxc.container
Mar 30 06:53:07 box /etc/init.d/lxd[17725]: start-stop-daemon: no matching processes found
Indeed, there are different major versions (LXD 2, LXD 3) and there are differences in the way the configuration is stored and handled.
An option would be to uninstall LXD 3.0 from Ubuntu 18.04 (deb package), and install the snap version of LXD, the one from the 2.0/stable channel. That LXD is at version 2.0.11, supported until 2016+5 = 2021. You need to compare with the Gentoo version you already have so that the versions do not diverge too much.
I have installed the 2.0/stable from snap package. However, it creates its files in /var/snap/lxd/common/lxd instead of /var/lib/lxd.
What i need is files sitting in a ZFS dataset (say rpool/liblxd) mounted to /var/lib/lxd. This dataset can then be shared in both Gentoo and Ubuntu. The snap package kills this inter-operability.
Is there a way to bind mount /var/lib/lxd to /var/snap/lxd/common/lxd ?