I have Ubuntu 18.04 running with LXD in the host and about 300 containers.
LXD (as the title suggests), was installed using snap
.
In the past year, I have faced twice this error (last time was yesterday): /var/snap/lxd/common/lxd/unix.socket: connect: no such file or directory
.
The error happens when using lxc
command (any command).
The problem is that even though the containers are operating as usual, I can not control them anymore.
I have read about a similar bug report here: https://github.com/lxc/lxd/issues/5423. Restarting the service throws no error (and seems to be successful), but the error persists. Even starting it in debug
mode, show no errors or malfunction.
The best solution so far has been to restart the server but that means offline time for all containers.
I suspect the reason is due to snap refreshing automatically, but it seems that disabling it is not an alternative. Reverting didn't change anything.
What do I need to do to prevent such kind of situations? or in the worst case, how can I recover from such state without restarting?
Unfortunately the server was restarted so I can not test it now, but I would like to know for future reference.
Every LXC Operation or process is captured in a socket file.
You are not having this /var/snap/lxd/common/lxd/unix.socket file. By Some-means, it might got deleted.
This is the reason why you are not able to do any lxc operations.
Just try creating that file with no contents.
No Restart of LXC Service needed.
Hope this works.