ganto / copr-lxc3

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

Creating a new container fails with "Error: Failed to run: /usr/libexec/lxd/lxd forkstart" #4

Closed ganto closed 6 years ago

ganto commented 6 years ago

When trying to start a container with lxd-3.0.0-0.4 the command would abort with:

[vagrant@localhost ~]$ lxc start u1
Error: Failed to run: /usr/libexec/lxd/lxd forkstart u1 /var/lib/lxd/containers /var/log/lxd/u1/lxc.conf:
Try `lxc info --show-log u1` for more info
[vagrant@localhost ~]$ lxc info --show-log u1
Name: u1
Remote: unix://
Architecture: x86_64
Created: 2018/05/08 19:32 UTC
Status: Stopped
Type: persistent
Profiles: default

Log:

lxc 20180508194042.239 ERROR    lxc_conf - conf.c:run_buffer:347 - Script exited with status 1
lxc 20180508194042.239 ERROR    lxc_start - start.c:lxc_init:815 - Failed to run lxc.hook.pre-start for container "u1"
lxc 20180508194042.239 ERROR    lxc_start - start.c:__lxc_start:1832 - Failed to initialize container "u1"
lxc 20180508194042.240 ERROR    lxc_container - lxccontainer.c:wait_on_daemonized_start:815 - No such file or directory - Failed to receive the container state

When stracing the lxd process, it seems that there are some commands invoked which are not aware of the custom set LXD_SOCKET:

[pid 23297] 23:40:17.425930 execve("/bin/sh", ["sh", "-c", "exec /usr/libexec/lxd/lxd callhook /var/lib/lxd 2 start u1 lxc pre-start"], [/* 14 vars */]) = 0 <0.001295> 
...
[pid 23297] 23:40:17.594356 connect(3<socket:[56737]>, {sa_family=AF_LOCAL, sun_path="/var/lib/lxd/unix.socket"}, 27 <unfinished ...>
[pid 23297] 23:40:17.594462 <... connect resumed> ) = -1 ENOENT (No such file or directory) <0.000084>                                                                    
...
[pid 23297] 23:40:17.594935 write(2<pipe:[56716]>, "Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory\n", 106 = 106 <0.000095>
[pid 23296] 23:40:17.595061 <... read resumed> "Error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory\n", 4096) = 106 
<0.169504>
ganto commented 6 years ago

I added an experimental patch to lxd-3.0.0-0.5 which should solve the issue.

Patch submitted upstream lxc/lxd#4551.