From 0e18e5db994f416580e8c6fbe3351a721ee5ec35 Mon Sep 17 00:00:00 2001 From: Arian van Putten Date: Fri, 8 May 2020 14:15:41 +0200 Subject: [PATCH 1/3] nixos/resolved: Include dbus alias of resolved unit This will make dbus socket activation for it work When `systemd-resolved` is restarted; this would lead to unavailability of DNS lookups. You're supposed to use DBUS socket activation to buffer resolved requests; such that restarts happen without downtime --- nixos/modules/system/boot/resolved.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/system/boot/resolved.nix b/nixos/modules/system/boot/resolved.nix index b7aaef575ac1..b024f9cf5ee9 100644 --- a/nixos/modules/system/boot/resolved.nix +++ b/nixos/modules/system/boot/resolved.nix @@ -148,6 +148,7 @@ in systemd.services.systemd-resolved = { wantedBy = [ "multi-user.target" ]; + aliases = [ "dbus-org.freedesktop.resolve1.service" ]; restartTriggers = [ config.environment.etc."systemd/resolved.conf".source ]; }; From cd1dedac67d4b077a556a660ef5724c909da8006 Mon Sep 17 00:00:00 2001 From: Arian van Putten Date: Tue, 19 May 2020 11:04:14 +0200 Subject: [PATCH 2/3] nixos/networkd: Make activatible through dbus and netlink With this systemd buffers netlink messages in early boot from the kernel itself; and passes them on to networkd for processing once it's started. Makes sure no routing messages are missed. Also makes an alias so that dbus can activate this unit. Upstream has this too. --- nixos/modules/system/boot/networkd.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 9b34b12e73a5..b0545363b330 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -1178,14 +1178,22 @@ in users.users.systemd-network.group = "systemd-network"; systemd.additionalUpstreamSystemUnits = [ - "systemd-networkd.service" "systemd-networkd-wait-online.service" + "systemd-networkd-wait-online.service" + "systemd-networkd.service" + "systemd-networkd.socket" ]; systemd.network.units = mapAttrs' (n: v: nameValuePair "${n}.netdev" (netdevToUnit n v)) cfg.netdevs // mapAttrs' (n: v: nameValuePair "${n}.network" (networkToUnit n v)) cfg.networks; + # systemd-networkd is socket-activated by kernel netlink route change + # messages. It is important to have systemd buffer those on behalf of + # networkd. + systemd.sockets.systemd-networkd.wantedBy = [ "sockets.target" ]; + systemd.services.systemd-networkd = { wantedBy = [ "multi-user.target" ]; + aliases = [ "dbus-org.freedesktop.network1.service" ]; restartTriggers = map (x: x.source) (attrValues unitFiles); # prevent race condition with interface renaming (#39069) requires = [ "systemd-udev-settle.service" ]; From 71a6d32c18edd0312a7436910b00d21d5e6d4c0f Mon Sep 17 00:00:00 2001 From: Arian van Putten Date: Tue, 19 May 2020 11:06:32 +0200 Subject: [PATCH 3/3] nixos/timesyncd: Make dbus-activatible Upstream has this alias too; so that dbus activation works. What I don't fully understand is why this would ever be useful given this unit is already started way in early boot; even before dbus is up. But lets just keep behaviour similar to upstream and then ask these questions to upstream. --- nixos/modules/system/boot/timesyncd.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/system/boot/timesyncd.nix b/nixos/modules/system/boot/timesyncd.nix index 9e2f36ca01f8..35fb5578b070 100644 --- a/nixos/modules/system/boot/timesyncd.nix +++ b/nixos/modules/system/boot/timesyncd.nix @@ -41,6 +41,7 @@ with lib; systemd.services.systemd-timesyncd = { wantedBy = [ "sysinit.target" ]; + aliases = [ "dbus-org.freedesktop.timesync1.service" ]; restartTriggers = [ config.environment.etc."systemd/timesyncd.conf".source ]; };