ganto / copr-lxc3

RPM spec files for building lxc-3 on Fedora COPR
MIT License
8 stars 2 forks source link

lxd-containers.service: /var/lib/lxd/unix.socket: connect: no such file or directory #5

Closed woky closed 6 years ago

woky commented 6 years ago

lxd-containers service is looking for wrong socket:

[root@titan lxd]# systemctl status lxd-containers
? lxd-containers.service - LXD - container startup/shutdown
   Loaded: loaded (/usr/lib/systemd/system/lxd-containers.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-05-22 15:58:07 CEST; 2s ago
     Docs: man:lxd(1)
  Process: 1905 ExecStop=/usr/libexec/lxd/shutdown (code=exited, status=0/SUCCESS)
  Process: 2131 ExecStart=/usr/bin/lxd activateifneeded (code=exited, status=1/FAILURE)
 Main PID: 2131 (code=exited, status=1/FAILURE)

May 22 15:58:07 titan systemd[1]: Starting LXD - container startup/shutdown...
May 22 15:58:07 titan lxd[2131]: Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory
May 22 15:58:07 titan systemd[1]: lxd-containers.service: Main process exited, code=exited, status=1/FAILURE
May 22 15:58:07 titan systemd[1]: lxd-containers.service: Failed with result 'exit-code'.
May 22 15:58:07 titan systemd[1]: Failed to start LXD - container startup/shutdown.

Workaround:

[root@titan lxd]# pwd
/var/lib/lxd
[root@titan lxd]# ln -s /run/lxd.socket unix.socket
[root@titan lxd]# systemctl start lxd-containers
[root@titan lxd]# systemctl status lxd-containers
? lxd-containers.service - LXD - container startup/shutdown
   Loaded: loaded (/usr/lib/systemd/system/lxd-containers.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2018-05-22 15:58:37 CEST; 2s ago
     Docs: man:lxd(1)
  Process: 1905 ExecStop=/usr/libexec/lxd/shutdown (code=exited, status=0/SUCCESS)
  Process: 2149 ExecStart=/usr/bin/lxd activateifneeded (code=exited, status=0/SUCCESS)
 Main PID: 2149 (code=exited, status=0/SUCCESS)

May 22 15:58:36 titan systemd[1]: Starting LXD - container startup/shutdown...
May 22 15:58:37 titan systemd[1]: Started LXD - container startup/shutdown.
ganto commented 6 years ago

Sorry for the late reply. I somehow missed the notification from Github regarding this issue.

If you just freshly installed lxd from this repository or updated from <=lxd-3.0.0-0.1 to the latest version, you must logout and login again or run source /etc/profile to get the correct socket path. This because the path is customized via LXD_SOCKET environment variable to fit the Fedora SELinux container profile.

Thanks for the hint tough. I'll add a note to the setup instruction on the COPR page.

Could you try to remove the symlink and report back if it still works?

nitzmahone commented 6 years ago

The symlink didn't work for me- I was able to manually start lxd.service post-boot to get things working, but not lxd-containers.service. Turns out the wrapper service needs the same environment override lxd.service has for the socket location. #8 adds that.

PS @ganto thanks so much for maintaining lxd packaging for Fedora! I built/installed manually a couple times before finding your package- makes life so much easier...

ganto commented 6 years ago

Thanks a lot for the patch. I updated the .spec file so this should be fixed now.

I also updated the instructions at COPR: ganto/lxc3 to hint about the new variable.