From ed5988f0d2cf14e3cc35a32e6ad91d7cbf535e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 4 Jun 2025 17:01:23 +0200 Subject: [PATCH] =?UTF-8?q?linux-container:=20=E2=80=98containerized-opera?= =?UTF-8?q?ting-system=E2=80=99=20provides=20=E2=80=98loopback=E2=80=99=20?= =?UTF-8?q?service.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Change-Id: I326b5f3b5e08f67b6613c186497c44b1e887b02e --- gnu/system/linux-container.scm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 8e208d3a70..e9be2c9d8a 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -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