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.
This commit is contained in:
parent
552ffa021c
commit
4c14d4eaa7
|
@ -214,15 +214,18 @@ host user identifiers to map into the user namespace."
|
|||
(lambda ()
|
||||
(close out)
|
||||
;; Wait for parent to set things up.
|
||||
(read in)
|
||||
(close in)
|
||||
(purify-environment)
|
||||
(when (memq 'mnt namespaces)
|
||||
(mount-file-systems root mounts
|
||||
#:mount-/proc? (memq 'pid namespaces)
|
||||
#:mount-/sys? (memq 'net namespaces)))
|
||||
;; TODO: Manage capabilities.
|
||||
(thunk))))
|
||||
(match (read in)
|
||||
('ready
|
||||
(close in)
|
||||
(purify-environment)
|
||||
(when (memq 'mnt namespaces)
|
||||
(mount-file-systems root mounts
|
||||
#:mount-/proc? (memq 'pid namespaces)
|
||||
#:mount-/sys? (memq 'net namespaces)))
|
||||
;; TODO: Manage capabilities.
|
||||
(thunk))
|
||||
(_ ;parent died or something
|
||||
(primitive-exit 2))))))
|
||||
(pid
|
||||
(when (memq 'user namespaces)
|
||||
(initialize-user-namespace pid host-uids))
|
||||
|
|
Loading…
Reference in New Issue