~ruther/guix-local

ed5988f0d2cf14e3cc35a32e6ad91d7cbf535e2f — Ludovic Courtès 11 months ago 1ed9af7
linux-container: ‘containerized-operating-system’ provides ‘loopback’ service.

Fixes #420.

Previously, in systems produced by ‘guix system container’, the
‘loopback’ Shepherd service would fail to start with EEXIST, because the
“lo” interface already exists in the container.  This commit provides a
fake ‘loopback’ Shepherd service that does nothing.

* gnu/system/linux-container.scm (dummy-networking-service-type): Change
to honor its configuration value.
(containerized-operating-system)[services-to-drop]: Add
‘static-networking-service-type’ in the non-‘shared-network?’ case.
[services-to-add]: Add ‘dummy-networking-service-type’ for loopback in
the non-‘shared-network?’ case.

Reported-by: Antonio Carlos Padoan Junior <acpadoanjr@yahoo.com.br>
Change-Id: I326b5f3b5e08f67b6613c186497c44b1e887b02e
1 files changed, 11 insertions(+), 8 deletions(-)

M gnu/system/linux-container.scm
M gnu/system/linux-container.scm => gnu/system/linux-container.scm +11 -8
@@ 78,12 78,13 @@ from OS that are needed on the bare metal and not in a container."
(define dummy-networking-service-type
  (shepherd-service-type
   'dummy-networking
   (const (shepherd-service
           (documentation "Provide loopback and networking without actually
   (lambda (provision)
     (shepherd-service
      (documentation "Provide loopback and networking without actually
doing anything.")
           (provision '(loopback networking))
           (start #~(const #t))))
   #f
      (provision provision)
      (start #~(const #t))))
   '(loopback networking)
   (description "Provide loopback and networking without actually doing
anything.  This service is used by guest systems running in containers, where
networking support is provided by the host.")))


@@ 135,7 136,7 @@ containerized OS.  EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
                 dhcp-client-service-type
                 network-manager-service-type
                 connman-service-type)
                (list))))
                (list static-networking-service-type)))) ;loopback

  (define services-to-add
    ;; Many Guix services depend on a 'networking' shepherd


@@ 143,8 144,10 @@ containerized OS.  EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
    ;; service when we are sure that networking is already set up
    ;; in the host and can be used.  That prevents double setup.
    (if shared-network?
        (list (service dummy-networking-service-type))
        '()))
        (list (service dummy-networking-service-type
                       '(loopback networking)))
        (list (service dummy-networking-service-type
                       '(loopback)))))

  (define os-with-base-essential-services
    (operating-system