Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Networkmanager: rename service to match upstream #51382

Open
wants to merge 3 commits into
base: master
from

Conversation

@Mic92
Copy link
Contributor

Mic92 commented Dec 2, 2018

Motivation for this change

Compatibility with other distributions/software and expectation
of users coming from other systems should have higher priority over consistency.
In particular this fixes #51375, where the NetworkManager-wait-online.service
broke as a result of this.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Mic92 Mic92 requested a review from Infinisil as a code owner Dec 2, 2018

@Mic92 Mic92 requested a review from jtojnar Dec 2, 2018

@Mic92 Mic92 force-pushed the Mic92:network-manager branch Dec 2, 2018

@Mic92 Mic92 changed the title Networkmanager: rename service to match upstream [WIP] Networkmanager: rename service to match upstream Dec 2, 2018

@Mic92

This comment has been minimized.

Copy link
Contributor Author

Mic92 commented Dec 2, 2018

There is one blocker though. When doing the upgrade it did not start NetworkManager again for automatically. Does anybody know why?

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Dec 2, 2018

Try

--- a/pkgs/tools/networking/modem-manager/default.nix
+++ b/pkgs/tools/networking/modem-manager/default.nix
@@ -27,30 +27,16 @@
     "--with-polkit"
     "--with-udev-base-dir=$(out)/lib/udev"
     "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
+    "--with-dbus-sys-dir=$(out)/etc/dbus-1/system.d"
     "--sysconfdir=/etc"
     "--localstatedir=/var"
     "--with-suspend-resume=systemd"
   ];
 
-  installFlags = [ "DESTDIR=\${out}" ];
-
-  preInstall = ''
-    mkdir -p $out/etc/systemd/system
-  '';
-
   postInstall = ''
-    # rename to modem-manager to be in style
-    mv $out/$out/etc/systemd/system/ModemManager.service $out/etc/systemd/system/modem-manager.service
-    rm -rf $out/$out/etc
-    mv $out/$out/* $out
-    DIR=$out/$out
-    while rmdir $DIR 2>/dev/null; do
-      DIR="$(dirname "$DIR")"
-    done
-
     # systemd in NixOS doesn't use `systemctl enable`, so we need to establish
     # aliases ourselves.
-    ln -s $out/etc/systemd/system/modem-manager.service \
+    ln -s $out/etc/systemd/system/ModemManager.service \
       $out/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service
   '';
 

Mic92 added some commits Dec 2, 2018

network-manager: rename systemd service back to match upstream
Compatibility with other distributions/software and expectation
of users coming from other systems should have higher priority over consistency.
In particular this fixes #51375, where the NetworkManager-wait-online.service
broke as a result of this.

@Mic92 Mic92 force-pushed the Mic92:network-manager branch to f7a3cb0 Dec 2, 2018

@Mic92

This comment has been minimized.

Copy link
Contributor Author

Mic92 commented Dec 2, 2018

Applied. This probably fixes also some references in modemmanager.

@jtojnar

jtojnar approved these changes Dec 2, 2018

@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Jan 3, 2019

Would keeping the legacy service name fix the transition issue? ln -s $out/etc/systemd/system/NetworkManager.service $out/etc/systemd/system/network-manager.service

Anyway, even if this does not work, I would just merge this. It is not that bad.

@Legogris

This comment has been minimized.

Copy link

Legogris commented Jan 8, 2019

@jtojnar

Would keeping the legacy service name fix the transition issue? ln -s $out/etc/systemd/system/NetworkManager.service $out/etc/systemd/system/network-manager.service

That sounds prudent to me, considering people might have started depending on the naming we are now reverting.

Apply suggestions from code review
Co-Authored-By: Mic92 <Mic92@users.noreply.github.com>

@jtojnar jtojnar referenced this pull request Mar 15, 2019

Merged

modemmanager: 1.7.990 -> 1.10.0 #57689

3 of 10 tasks complete
@jtojnar

This comment has been minimized.

Copy link
Contributor

jtojnar commented Mar 18, 2019

There is one blocker though. When doing the upgrade it did not start NetworkManager again for automatically. Does anybody know why?

I would say this is reasonable price to pay. User can always restart the service manually.

@flokli

This comment has been minimized.

Copy link
Contributor

flokli commented Mar 19, 2019

I gave @jtojnar's suggestion a try - adding the following patch:

From a201d69a825668570fbe0dc1837c229c6e70319a Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Tue, 19 Mar 2019 01:54:27 +0100
Subject: [PATCH] network-manager: add legacy service name to prevent
 NetworkManager from not starting back up

This can be removed once 19.10 is released.
---
 pkgs/tools/networking/network-manager/default.nix | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pkgs/tools/networking/network-manager/default.nix b/pkgs/tools/networking/network-manager/default.nix
index 3df029310fe..9d1ff4bb8c9 100644
--- a/pkgs/tools/networking/network-manager/default.nix
+++ b/pkgs/tools/networking/network-manager/default.nix
@@ -92,6 +92,11 @@ in stdenv.mkDerivation rec {
     # aliases ourselves.
     ln -s $out/etc/systemd/system/NetworkManager-dispatcher.service $out/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service
     ln -s $out/etc/systemd/system/NetworkManager.service $out/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service
+
+    # Add the legacy service name from before #51382 to prevent NetworkManager
+    # from not starting back up:
+    # TODO: remove this once 19.10 is released
+    ln -s $out/etc/systemd/system/NetworkManager.service $out/etc/systemd/system/network-manager.service
   '';
 
   passthru = {
-- 
2.19.2

And I was able to switch to the new configuration with NetworkManager restarting properly:

stopping the following units: accounts-daemon.service, bolt.service, fwupd.service, home-manager-flokli.service, network-manager.service, systemd-udevd-control.socket, systemd-udevd-kernel.socket, systemd-udevd.service, tlp.service
NOT restarting the following changed units: systemd-fsck@dev-disk-by\x2duuid-XXXX\x2dXXXX.service
activating the configuration...
setting up /etc...
reloading user units for flokli...
setting up tmpfiles
reloading the following units: dbus.service
restarting the following units: polkit.service
starting the following units: accounts-daemon.service, bolt.service, fwupd.service, home-manager-flokli.service, network-manager.service, systemd-udevd-control.socket, systemd-udevd-kernel.socket, tlp.service
the following new units were started: NetworkManager-dispatcher.service, NetworkManager.service, systemd-hostnamed.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.