summary refs log tree commit diff
path: root/gnu/services/base.scm
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2018-10-21 23:18:19 +0200
committerJan Nieuwenhuizen <janneke@gnu.org>2018-10-21 23:19:35 +0200
commitcf7658f7cb5de0e17f4801faa84c378a4b40033e (patch)
tree646fa120d67bb41868a543461700e62aa170b2c0 /gnu/services/base.scm
parent09c5a5680a06011f985a84aa26fb890b3be453bd (diff)
parentffddb42d6c510456997ee6de1c1b8026c9ce6d14 (diff)
downloadguix-cf7658f7cb5de0e17f4801faa84c378a4b40033e.tar.gz
Merge branch 'core-updates' into core-updates-next
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r--gnu/services/base.scm32
1 files changed, 20 insertions, 12 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 5ba2c6b86d..47c7d8bb27 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -685,17 +685,20 @@ to add @var{device} to the kernel's entropy pool.  The service will fail if
   (shepherd-service-type
    'virtual-terminal
    (lambda (utf8?)
-     (shepherd-service
-      (documentation "Set virtual terminals in UTF-8 module.")
-      (provision '(virtual-terminal))
-      (requirement '(root-file-system))
-      (start #~(lambda _
-                 (call-with-output-file
-                     "/sys/module/vt/parameters/default_utf8"
-                   (lambda (port)
-                     (display 1 port)))
-                 #t))
-      (stop #~(const #f))))
+     (let ((knob "/sys/module/vt/parameters/default_utf8"))
+       (shepherd-service
+        (documentation "Set virtual terminals in UTF-8 module.")
+        (provision '(virtual-terminal))
+        (requirement '(root-file-system))
+        (start #~(lambda _
+                   ;; In containers /sys is read-only so don't insist on
+                   ;; writing to this file.
+                   (unless (= 1 (call-with-input-file #$knob read))
+                     (call-with-output-file #$knob
+                       (lambda (port)
+                         (display 1 port))))
+                   #t))
+        (stop #~(const #f)))))
    #t))                                           ;default to UTF-8
 
 (define console-keymap-service-type
@@ -1881,7 +1884,12 @@ item of @var{packages}."
                             (string-append linux-module-directory "/"
                                            kernel-release))
                            (old-umask (umask #o022)))
-                      (make-static-device-nodes directory)
+                      ;; If we're in a container, DIRECTORY might not exist,
+                      ;; for instance because the host runs a different
+                      ;; kernel.  In that case, skip it; we'll just miss a few
+                      ;; nodes like /dev/fuse.
+                      (when (file-exists? directory)
+                        (make-static-device-nodes directory))
                       (umask old-umask))
 
                     (let ((pid (fork+exec-command (list udevd))))