From patchwork Fri Feb 17 21:14:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 47073 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 25F92168F8; Fri, 17 Feb 2023 21:17:23 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4F6FD16734 for ; Fri, 17 Feb 2023 21:17:22 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pT86L-0005Cx-8x; Fri, 17 Feb 2023 16:17:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pT86I-00058u-T7 for guix-patches@gnu.org; Fri, 17 Feb 2023 16:17:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pT86I-0004ZT-J0 for guix-patches@gnu.org; Fri, 17 Feb 2023 16:17:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pT86I-00007r-EW for guix-patches@gnu.org; Fri, 17 Feb 2023 16:17:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61587] [PATCH 6/8] services: network-manager: Await for NetworkManager to finish starting up. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 17 Feb 2023 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61587 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61587@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 61587-submit@debbugs.gnu.org id=B61587.1676668571386 (code B ref 61587); Fri, 17 Feb 2023 21:17:02 +0000 Received: (at 61587) by debbugs.gnu.org; 17 Feb 2023 21:16:11 +0000 Received: from localhost ([127.0.0.1]:41721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT85T-00006A-BK for submit@debbugs.gnu.org; Fri, 17 Feb 2023 16:16:11 -0500 Received: from smtpm3.myservices.hosting ([185.26.105.234]:42848) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pT85S-000062-CS for 61587@debbugs.gnu.org; Fri, 17 Feb 2023 16:16:10 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpm3.myservices.hosting (Postfix) with ESMTP id AA79B20FAB for <61587@debbugs.gnu.org>; Fri, 17 Feb 2023 22:16:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 515C48009D; Fri, 17 Feb 2023 22:16:09 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xqnNzofvaOGM; Fri, 17 Feb 2023 22:16:09 +0100 (CET) Received: from guix-nuc.home.arpa (bl9-119-177.dsl.telepac.pt [85.242.119.177]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id E04398009B; Fri, 17 Feb 2023 22:16:08 +0100 (CET) From: Bruno Victal Date: Fri, 17 Feb 2023 21:14:57 +0000 Message-Id: <502d6efbde6d7e372ab6bc414fbbe2c065c23b4e.1676667941.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This is similar to its NetworkManager-wait-online.service systemd counterpart, with the main difference being that we handle it all in 'networking symbol, rather than introduce a new 'networking-online symbol. (see discussion #47253) As a result of this change, with opensmtpd-service-type as an example, manual 'herd restart smtpd' after system bootups are no longer required when opensmtpd is configured with a smtpd.conf containing non-loopback interfaces. (this issue is described in more detail at #60300) Addresses #60300. Supersedes #47253. (Note: Shepherd no longer blocks since shepherd 0.9.3) * gnu/services/networking.scm (network-manager-shepherd-service): Await for NetworkManager to finish starting up. --- gnu/services/networking.scm | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 13816327b0..55bc2cf362 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1235,17 +1235,31 @@ (define (network-manager-shepherd-service config) ;; TODO: iwd? is deprecated and should be passed ;; with shepherd-requirement, remove later. ,@(if iwd? '(iwd) '()))) - (start #~(make-forkexec-constructor - (list (string-append #$network-manager - "/sbin/NetworkManager") - (string-append "--config=" #$conf) - "--no-daemon") - #:environment-variables - (list (string-append "NM_VPN_PLUGIN_DIR=" #$vpn - "/lib/NetworkManager/VPN") - ;; Override non-existent default users - "NM_OPENVPN_USER=" - "NM_OPENVPN_GROUP="))) + (start + #~(lambda args + (let ((constructor + (apply + (make-forkexec-constructor + (list #$(file-append network-manager + "/sbin/NetworkManager") + (string-append "--config=" #$conf) + "--no-daemon") + #:environment-variables + (list (string-append "NM_VPN_PLUGIN_DIR=" #$vpn + "/lib/NetworkManager/VPN") + ;; Override non-existent default users + "NM_OPENVPN_USER=" + "NM_OPENVPN_GROUP=")) args))) + ;; XXX: Despite the "online" name, this doesn't guarantee + ;; WAN connectivity, it merely waits for NetworkManager + ;; to finish starting-up. This is required otherwise + ;; services will fail since the network interfaces be + ;; absent until NetworkManager finishes setting them up. + (system* #$(file-append network-manager "/bin/nm-online") + "--wait-for-startup" "--quiet") + ;; XXX: Finally, return the value from running + ;; make-forkexec-constructor to shepherd. + constructor))) (stop #~(make-kill-destructor))))))) (define network-manager-service-type