Error: listen unix /var/snap/lxd/common/lxd/logs/NAME/forkfile.sock: bind: no such file or directory when using lxc file push immediately after lxd-migrate

I’m migrating a bunch of openvz containers to lxd and after successfuly migrating two dozen of them, all of a sudden I have started getting:

Error: listen unix /var/snap/lxd/common/lxd/logs/NAME/forkfile.sock: bind: no such file or directory

when trying to do lxc file push something NAME/something, immediately after lxd-migrate completes

i have tried waiting a bit as I’m scripting the whole thing using expect, so the push comes immediately after lxd-migrate exited, but it didn’t help, all I have found to be successful is to do ‘lxc ls NAME’ and after that file push operations would magically started to work

Although I seem to have have found a workaround, this worries me a bit, especially since it started suddenly. Any ideas what might be happening here?

@tomp could you send a quick fix for this one?

My guess is that it happens when someone hits the new files API before d.LogPath() exists. I’ve not had much chance reproducing this as standard instance creation seems to always give us a logpath, but it sounds like migration may not?

This should fix it:

The reason lxc ls fixes it also is because accessing the state of the container causes liblxc to write its log file and creates the log path directory in the process.