diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-05-30 22:13:09 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-05-31 00:11:04 +0200 |
| commit | 4c14d4eaa7ee9d5d89c04a41adb50c7c532d14e1 (patch) | |
| tree | 19893b3db7d7ffc0f7c9f407d418ec637e643a36 /gnu/build/linux-container.scm | |
| parent | 552ffa021ce87ece4aeecf5c8d9786f559991d3a (diff) | |
container: Gracefully handle failure to set up user namespaces.
* gnu/build/linux-container.scm (run-container): Exit when the parent
process doesn't say 'ready.
Diffstat (limited to 'gnu/build/linux-container.scm')
| -rw-r--r-- | gnu/build/linux-container.scm | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gnu/build/linux-container.scm b/gnu/build/linux-container.scm index ec68679f0b6..562d50bcc78 100644 --- a/gnu/build/linux-container.scm +++ b/gnu/build/linux-container.scm | |||
| @@ -214,15 +214,18 @@ host user identifiers to map into the user namespace." | |||
| 214 | (lambda () | 214 | (lambda () |
| 215 | (close out) | 215 | (close out) |
| 216 | ;; Wait for parent to set things up. | 216 | ;; Wait for parent to set things up. |
| 217 | (read in) | 217 | (match (read in) |
| 218 | (close in) | 218 | ('ready |
| 219 | (purify-environment) | 219 | (close in) |
| 220 | (when (memq 'mnt namespaces) | 220 | (purify-environment) |
| 221 | (mount-file-systems root mounts | 221 | (when (memq 'mnt namespaces) |
| 222 | #:mount-/proc? (memq 'pid namespaces) | 222 | (mount-file-systems root mounts |
| 223 | #:mount-/sys? (memq 'net namespaces))) | 223 | #:mount-/proc? (memq 'pid namespaces) |
| 224 | ;; TODO: Manage capabilities. | 224 | #:mount-/sys? (memq 'net namespaces))) |
| 225 | (thunk)))) | 225 | ;; TODO: Manage capabilities. |
| 226 | (thunk)) | ||
| 227 | (_ ;parent died or something | ||
| 228 | (primitive-exit 2)))))) | ||
| 226 | (pid | 229 | (pid |
| 227 | (when (memq 'user namespaces) | 230 | (when (memq 'user namespaces) |
| 228 | (initialize-user-namespace pid host-uids)) | 231 | (initialize-user-namespace pid host-uids)) |
