[systemd-devel] [PATCH] nspawn: less cryptic error when clone() fails due to lack of adaquate namespace support in kernel

Shawn Landden shawnlandden at gmail.com
Mon Mar 5 17:01:38 PST 2012


Running systemd-nspawn on a Linux kernel compiled without

  CONFIG_NAMESPACES=y
  CONFIG_UTS_NS=y
  CONFIG_IPC_NS=y
  CONFIG_PID_NS=y
  CONFIG_NET_NS=y

fails with the cryptic error message

  clone() failed: Invalid argument

Give user a more helpful error message when clone() fails
---
 src/nspawn.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/nspawn.c b/src/nspawn.c
index b8b379d..e70b658 100644
--- a/src/nspawn.c
+++ b/src/nspawn.c
@@ -707,7 +707,7 @@ int main(int argc, char *argv[]) {
         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");
+                log_error("clone() failed, do you have kernel namespace support (CONFIG: UTS_NS, IPC_NS, PID_NS, NET_NS)?: %m");
                 goto finish;
         }
 
-- 
1.7.5.4



More information about the systemd-devel mailing list