]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Try to be more helpful on container startup failure
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 4 Jun 2014 18:05:25 +0000 (14:05 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 4 Jun 2014 21:03:24 +0000 (17:03 -0400)
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: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/commands.c
src/lxc/lxc_start.c

index b71274c3e250543ceffcd0b2b76e11564acec926..458d41e1f7c9c7ead1e83dda410773de1c102f3d 100644 (file)
@@ -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));
        if (ret < 0) {
-               ERROR("command %s failed to receive response",
-                     lxc_cmd_str(cmd->req.cmd));
+               WARN("command %s failed to receive response",
+                    lxc_cmd_str(cmd->req.cmd));
                return -1;
        }
 
index 9b47e8cd19b3d02661d92b0554e2dcb38a3e67b6..1d8145fcd1a9dff96f1850dcc03e7855ffde94ef 100644 (file)
@@ -329,8 +329,16 @@ int main(int argc, char *argv[])
                c->want_close_all_fds(c, true);
 
        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:
        lxc_container_put(c);
        return err;
 }
-