all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47253: network-manager shepherd services does not wait to be online
@ 2021-03-19  3:38 raid5atemyhomework via Bug reports for GNU Guix
  2021-03-19 12:07 ` Mark H Weaver
  0 siblings, 1 reply; 7+ messages in thread
From: raid5atemyhomework via Bug reports for GNU Guix @ 2021-03-19  3:38 UTC (permalink / raw)
  To: 47253

I have a small number of daemons that need access to the network at startup.  I have configured their Shepherd services to require `networking`.

However, to my puzzlement, I consistently find that they are unable to access the network at startup.  One daemon dies (and gets respawned so often that it sometimes gets disabled by Shepherd), the other daemon just keeps running without having set up the server that I need it to expose.

Thus, in many cases whenever I reboot I have to manually `herd enable` and `herd restart` the first daemon and `herd restart` the second.  This is fairly bad since I want to be able to leave this server alone and have it survive power interruptions etc.

Checking on other systems, I stumbled on this file on SystemD-based systems:

```systemd
[Unit]
Description=Network Manager Wait Online
Documentation=man:nm-online(1)
Requires=NetworkManager.service
After=NetworkManager.service
Before=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -s -q --timeout=30
RemainAfterExit=yes

[Install]
WantedBy=network-online.target
```

Searching the Guix source code, I can't find any `nm-online` command.  So I think that, when using the `network-manager` service type, the `networking` provision is considered started even though networking isn't actually online yet.

I would like to propose this change:

```diff
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1106,17 +1106,22 @@ and @command{wicd-curses} user interfaces."
               (documentation "Run the NetworkManager.")
               (provision '(networking))
               (requirement '(user-processes dbus-system wpa-supplicant loopback))
-              (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 #~(let ((constructor   (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="))))
+                         (lambda args
+                           (let ((pid (apply constructor args)))
+                             (invoke/quiet (string-append #$network-manager "/bin/nm-online")
+                                           "-s" "-q" "--timeout=30")
+                             pid))))
               (stop #~(make-kill-destructor))))))))

 (define network-manager-service-type
```


Of course, the big problem is that Shepherd is single-threadded and `nm-online` will block all other bootup.






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-07-24 12:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-19  3:38 bug#47253: network-manager shepherd services does not wait to be online raid5atemyhomework via Bug reports for GNU Guix
2021-03-19 12:07 ` Mark H Weaver
2021-03-19 16:03   ` raid5atemyhomework via Bug reports for GNU Guix
2021-03-20  8:07     ` Mark H Weaver
2021-03-20 10:15       ` raid5atemyhomework via Bug reports for GNU Guix
2021-07-23 15:27         ` raid5atemyhomework via Bug reports for GNU Guix
2021-07-24 11:56           ` Bone Baboon via Bug reports for GNU Guix

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.