]> err.no Git - systemd/commitdiff
nspawn: be less cryptic when clone() fails
authorLennart Poettering <lennart@poettering.net>
Tue, 6 Mar 2012 01:06:29 +0000 (02:06 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 6 Mar 2012 01:06:29 +0000 (02:06 +0100)
Based on a patch suggested by Shawn Landden.

src/nspawn.c

index b8b379d9913d1fec63ff19ee53bf63a200119bbe..b548b126c6e5dccae2a71abcfdc07a5659d64135 100644 (file)
@@ -706,8 +706,13 @@ int main(int argc, char *argv[]) {
         sigset_add_many(&mask, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, -1);
         assert_se(sigprocmask(SIG_BLOCK, &mask, NULL) == 0);
 
-        if ((pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWIPC|CLONE_NEWNS|CLONE_NEWPID|CLONE_NEWUTS|(arg_private_network ? CLONE_NEWNET : 0), NULL)) < 0) {
-                log_error("clone() failed: %m");
+        pid = syscall(__NR_clone, SIGCHLD|CLONE_NEWIPC|CLONE_NEWNS|CLONE_NEWPID|CLONE_NEWUTS|(arg_private_network ? CLONE_NEWNET : 0), NULL);
+        if (pid < 0) {
+                if (errno == EINVAL)
+                        log_error("clone() failed, do you have namespace support enabled in your kernel? (You need UTS, IPC, PID and NET namespacing built in): %m");
+                else
+                        log_error("clone() failed: %m");
+
                 goto finish;
         }