LXD stoppped, containers still running and inconsistencies

Hi,

I’m testing moving /var/lib//lxd to a zfs ds and as part of that I’m stopping lxd.service and lxd.socket . When that’s done lxc calls won’t work anymore, however containers are still all running and indeed if I ssh into a container that works. At this point however I wondered - what if I shut down the container while lxd is down? And indeed once I tried that I seemed to end up in an inconsistent state where the container was down but after restarting lxd lxc list showed that container as running.

Is this expected? Should I be shutting down all the containers when I turn off lxd before doing the migration?

thanks,

Spike

It’s intentional, otherwise every LXD package update would respawn all your containers, which people don’t usually want :slight_smile:

If you want to shut everything down, you should do:

  • lxd shutdown
  • systemctl stop lxd.service lxd.socket
  • Do whatever you need to do
  • systemctl start lxd

Which will shut everything down and then start them all back when LXD goes back online.