Stopping snap lxd removes zpool. How to restart?

In snap, i do this snap restart lxd, and when i check, the zpool has disappeared. Not only that, all the associated zfs processes like [z_wr_int] [ z_rd_int ], etc are gone. Without a working zpool, lxc commands show Error: Get .... unix.socket: connect : permission denied

How do i restart zfs? And is this a bug with lxd/lxc?

zfs 0.8.3 on linux, snap 2.52.1 and ubuntu 20.04 ?

Hi placid_chat,
Can you post those command outputs? systemctl status snap.lxd.daemon and lxc info if lxd service is running and done the lxd init section.
Thanks.

The lxc/lxd version is 4.20, which is supposed to be the latest in the snapcraft.

lxc info is a fairly long list. But to be more clear. lxc/lxd has been working fine up to this point, and still is, it’s just if i do a snap restart lxd snap takes out all the zfs processes and hence lxd cannot start.

Sounds like the snap restart may have messed with the socket permissions. Did you try running sudo lxc info to connect to it as root (which should then fix the permissions again)?

When snap stops lxd, i take it the stop scripts might try to unmount the mounted zfs datasets? In any case there isn’t a unix.socket to connect to, so lxc info doesn’t work

Please show:

  • journalctl -u snap.lxd.daemon -n 30
  • systemctl -a | grep lxd
  • ls -lh /var/snap/lxd/common/lxd/unix.socket

LXD exports all ZFS pools on clean exit and imports it on startup, that’s normal.

In a major oops moment:

zpool says no pools are available and the vdevs are image files. I was wondering how to reinstate a zpool from these vdevs and did a zpool create tank -f <image> and it wiped out the vdevs. Luckily they’re just test images, though any form of recovery would be nice. Looks like i’ll have to lxd init again

Hi,
Sorry for the delay, you dont need to execute lxd init again, you can add a storage like this.
lxc storage create pool1 zfs source=<zfs-pool-name>
Regards.

Ok just as a reminder to myself as well.

snap restart lxd will export all the zpools. If you’re using vdevs, the zpool won’t be imported back, since the restart script has no idea where the vdevs are located. So the pool has to be manually imported first. Then snap start lxd.

If anyone is reusing lxd init, the entries for items like the interface or the storage are already in the default profile, so it is necessary to delete those entries if reusing storage pools or existing interfaces or the init script will complain.