guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/06: linux-container: 'containerized-operating-system' removes "useles


From: guix-commits
Subject: 06/06: linux-container: 'containerized-operating-system' removes "useless" services.
Date: Wed, 13 Mar 2019 18:12:56 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit b94c80ff5d844f7763738ab5359fee72f11f9367
Author: Ludovic Courtès <address@hidden>
Date:   Wed Mar 13 23:10:19 2019 +0100

    linux-container: 'containerized-operating-system' removes "useless" 
services.
    
    Fixes <https://bugs.gnu.org/34211>.
    Reported by Efraim Flashner <address@hidden>.
    
    * gnu/system/linux-container.scm (containerized-operating-system)
    [useless-services]: New variable.
    Add 'services' field.
---
 gnu/system/linux-container.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm
index bceea41..3fe3482 100644
--- a/gnu/system/linux-container.scm
+++ b/gnu/system/linux-container.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <address@hidden>
-;;; Copyright © 2016, 2017 Ludovic Courtès <address@hidden>
+;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +28,7 @@
   #:use-module (guix modules)
   #:use-module (gnu build linux-container)
   #:use-module (gnu services)
+  #:use-module (gnu services base)
   #:use-module (gnu system)
   #:use-module (gnu system file-systems)
   #:export (system-container
@@ -54,8 +55,19 @@ containerized OS."
     (file-system (inherit (file-system-mapping->bind-mount fs))
       (needed-for-boot? #t)))
 
+  (define useless-services
+    ;; Services that make no sense in a container.  Those that attempt to
+    ;; access /dev/tty[0-9] in particular cannot work in a container.
+    (list console-font-service-type
+          mingetty-service-type
+          agetty-service-type))
+
   (operating-system (inherit os)
     (swap-devices '()) ; disable swap
+    (services (remove (lambda (service)
+                        (memq (service-kind service)
+                              useless-services))
+                      (operating-system-user-services os)))
     (file-systems (append (map mapping->fs (cons %store-mapping mappings))
                           %container-file-systems
                           user-file-systems))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]