LXD snap services/mounts and LUKS

I am trying to get a working set-up for LXD snap on an luks encrypted zpool. Before the lxd snap services/mounts shoud start the luks devices have to be unlocked and the zpool imported offcourse.
So I am trying to find out what services/mounts I have to start manually after unlocking (will do do unlocking manually as well).
If I look at a normal running LXD snap system I see the following systemd units started:
$sudo systemctl list-units|grep lxd

sys-devices-virtual-net-lxdbr0.device loaded active plugged /sys/devices/virtual/net/lxdbr0
sys-subsystem-net-devices-lxdbr0.device loaded active plugged /sys/subsystem/net/devices/lxdbr0
run-snapd-ns-lxd.mnt.mount loaded active mounted /run/snapd/ns/lxd.mnt
snap-lxd-9277.mount loaded active mounted Mount unit for lxd, revision 9277
snap-lxd-9298.mount loaded active mounted Mount unit for lxd, revision 9298
snap-lxd-9354.mount loaded active mounted Mount unit for lxd, revision 9354
var-snap-lxd-common-ns-shmounts.mount loaded active mounted /var/snap/lxd/common/ns/shmounts
var-snap-lxd-common-ns.mount loaded active mounted /var/snap/lxd/common/ns
snap.lxd.daemon.service loaded active running Service for snap application lxd.daemon
snap.lxd.daemon.unix.socket loaded active running Socket unix for snap application lxd.daemon

Do I have to disable them all and start them all after the zpool is unlocked?? I also would like to have the LXD configuration on the encrypted zpool, so was thinking of bind mounting it to the right directorie. Is this the way to go or am I making things to complex now?

  • snap.lxd.daemon.unix.socket
  • snap.lxd.daemon.service

Restarting those two should do the trick.

Putting /var/snap/lxd/ on a dataset on your zpool should be fine, so long as you do make sure to bounce those units. Make sure to not mix LXD storage pools and other LXD data in the same dataset, instead do something like:

  • tank/lxd-config => /var/snap/lxd
  • tank/lxd => configured as storage pool in LXD
1 Like

Hi Stephane,

Thanks for the quick reply…So I was indeed thinking to complex :wink:
Thanks it’s working indeed.

For other readers: before importing the zpool, make sure that /var/snap/lxd is empty (or just remove it), so zfs can mount the dataset on it.