diff options
author | Shea Levy <shea@shealevy.com> | 2015-02-04T16·46-0500 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-04T17·15+0100 |
commit | d66d9e8425d52cc698851e2e85bd56aa96f45fc9 (patch) | |
tree | 821dead4a5a6d356dd65d81513649be45ce8a774 | |
parent | f3a5930488e4a25de33d9aacc2e14ae614614b5e (diff) |
Require linux 3.13 or later for chroot
Fixes #453
-rw-r--r-- | doc/manual/command-ref/conf-file.xml | 3 | ||||
-rw-r--r-- | src/libstore/build.cc | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/doc/manual/command-ref/conf-file.xml b/doc/manual/command-ref/conf-file.xml index 053f4d43cb0c..4bd73b2fc828 100644 --- a/doc/manual/command-ref/conf-file.xml +++ b/doc/manual/command-ref/conf-file.xml @@ -243,7 +243,8 @@ flag, e.g. <literal>--option gc-keep-outputs false</literal>.</para> users” feature</link> to perform the actual builds under different users than root). Currently, chroot builds only work on Linux because Nix uses “bind mounts” to make the Nix store and other - directories available inside the chroot.</para> + directories available inside the chroot. Kernel version 3.13 or later + is needed due to a PID namespace fix nix depends on.</para> </listitem> diff --git a/src/libstore/build.cc b/src/libstore/build.cc index e0398e2fb4a3..259324734fd1 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1970,7 +1970,12 @@ void DerivationGoal::startBuilder() char stack[32 * 1024]; pid_t child = clone(childEntry, stack + sizeof(stack) - 8, CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWNET | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD, this); - if (child == -1) throw SysError("cloning builder process"); + if (child == -1) { + if (errno == EINVAL) + throw SysError("cloning builder process (Linux chroot builds require 3.13 or later)"); + else + throw SysError("cloning builder process"); + } writeFull(builderOut.writeSide, int2String(child) + "\n"); _exit(0); }); |