summaryrefslogtreecommitdiff
path: root/gnu/build/shepherd.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-08-13 14:16:12 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-09-02 17:05:23 +0200
commit8ce6f4dc2879919c12bc76a2f4b01200af97e019 (patch)
treebcdfea85d25af8ae24622310a035688ac8257dcc /gnu/build/shepherd.scm
parent5316dfc0f125b658e4a2acf7f00f49501663d943 (diff)
installer: Run the installation inside a container.
When the store overlay is mounted, other processes such as kmscon, udev and guix-daemon may open files from the store, preventing the underlying install support from being umounted. See: https://lists.gnu.org/archive/html/guix-devel/2018-12/msg00161.html. To avoid this situation, mount the store overlay inside a container, and run the installation from within that container. * gnu/build/shepherd.scm (fork+exec-command/container): New procedure. * gnu/services/base.scm (guix-shepherd-service): Support an optional PID argument passed to the "start" method. If that argument is passed, ensure that guix-daemon enters the given PID MNT namespace by using fork+exec-command/container procedure. * gnu/installer/final.scm (umount-cow-store): Remove it, (install-system): run the installation from within a container. * gnu/installer/newt/final.scm (run-install-shell): Remove the display hack.
Diffstat (limited to 'gnu/build/shepherd.scm')
-rw-r--r--gnu/build/shepherd.scm18
1 files changed, 16 insertions, 2 deletions
diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm
index fd93e7f3f43..65141bd60f8 100644
--- a/gnu/build/shepherd.scm
+++ b/gnu/build/shepherd.scm
@@ -20,10 +20,12 @@
20 #:use-module (gnu system file-systems) 20 #:use-module (gnu system file-systems)
21 #:use-module (gnu build linux-container) 21 #:use-module (gnu build linux-container)
22 #:use-module (guix build utils) 22 #:use-module (guix build utils)
23 #:use-module (guix utils)
23 #:use-module (srfi srfi-1) 24 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-26) 25 #:use-module (srfi srfi-26)
25 #:use-module (ice-9 match) 26 #:use-module (ice-9 match)
26 #:export (make-forkexec-constructor/container)) 27 #:export (make-forkexec-constructor/container
28 fork+exec-command/container))
27 29
28;;; Commentary: 30;;; Commentary:
29;;; 31;;;
@@ -93,7 +95,8 @@
93;; XXX: Lazy-bind the Shepherd to avoid a compile-time dependency. 95;; XXX: Lazy-bind the Shepherd to avoid a compile-time dependency.
94(module-autoload! (current-module) 96(module-autoload! (current-module)
95 '(shepherd service) 97 '(shepherd service)
96 '(read-pid-file exec-command %precious-signals)) 98 '(fork+exec-command read-pid-file exec-command
99 %precious-signals))
97(module-autoload! (current-module) 100(module-autoload! (current-module)
98 '(shepherd system) '(unblock-signals)) 101 '(shepherd system) '(unblock-signals))
99 102
@@ -188,6 +191,17 @@ namespace, in addition to essential bind-mounts such /proc."
188 (read-pid-file pid-file #:max-delay pid-file-timeout)) 191 (read-pid-file pid-file #:max-delay pid-file-timeout))
189 pid)))) 192 pid))))
190 193
194(define* (fork+exec-command/container command
195 #:key pid
196 #:allow-other-keys
197 #:rest args)
198 "This is a variant of 'fork+exec-command' procedure, that joins the
199namespaces of process PID beforehand."
200 (container-excursion* pid
201 (lambda ()
202 (apply fork+exec-command command
203 (strip-keyword-arguments '(#:pid) args)))))
204
191;; Local Variables: 205;; Local Variables:
192;; eval: (put 'container-excursion* 'scheme-indent-function 1) 206;; eval: (put 'container-excursion* 'scheme-indent-function 1)
193;; End: 207;; End: