Commit 3fd1eb05 by Stéphane Graber

Try to be more helpful on container startup failure

This hides some of the confusing "command X failed to receive response" why are usually caused by another more understandable error. On failure to start() from lxc-start, a new error message is displayed, suggesting the user sets logfile and loglevel and if using -d, restarts the container in the foreground instead. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent 830105a0
...@@ -136,8 +136,8 @@ static int lxc_cmd_rsp_recv(int sock, struct lxc_cmd_rr *cmd) ...@@ -136,8 +136,8 @@ static int lxc_cmd_rsp_recv(int sock, struct lxc_cmd_rr *cmd)
ret = lxc_abstract_unix_recv_fd(sock, &rspfd, rsp, sizeof(*rsp)); ret = lxc_abstract_unix_recv_fd(sock, &rspfd, rsp, sizeof(*rsp));
if (ret < 0) { if (ret < 0) {
ERROR("command %s failed to receive response", WARN("command %s failed to receive response",
lxc_cmd_str(cmd->req.cmd)); lxc_cmd_str(cmd->req.cmd));
return -1; return -1;
} }
......
...@@ -329,8 +329,16 @@ int main(int argc, char *argv[]) ...@@ -329,8 +329,16 @@ int main(int argc, char *argv[])
c->want_close_all_fds(c, true); c->want_close_all_fds(c, true);
err = c->start(c, 0, args) ? 0 : 1; err = c->start(c, 0, args) ? 0 : 1;
if (err) {
ERROR("The container failed to start.");
if (my_args.daemonize)
ERROR("To get more details, run the container in foreground mode.");
ERROR("Additional information can be obtained by setting the "
"--logfile and --log-priority options.");
}
out: out:
lxc_container_put(c); lxc_container_put(c);
return err; return err;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment