From 52e2e7027d902e849fbc23b640580cc27056fca6 Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Sun, 13 Oct 2024 18:08:05 +0200 Subject: [PATCH] dhcpcd: fix race between namespace setup and resolvconf systemd requires paths in `ReadWritePaths=` to exist before setting up the service sandbox, so dhcpcd should be ordered after resolvconf. Making resolvconf a oneshot service ensure `After=resolvconf.service` works correctly. --- nixos/modules/config/resolvconf.nix | 1 + nixos/modules/services/networking/dhcpcd.nix | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nixos/modules/config/resolvconf.nix b/nixos/modules/config/resolvconf.nix index 6ffcbcabe519..0d56ccf85d4c 100644 --- a/nixos/modules/config/resolvconf.nix +++ b/nixos/modules/config/resolvconf.nix @@ -145,6 +145,7 @@ in wants = [ "network-pre.target" ]; wantedBy = [ "multi-user.target" ]; restartTriggers = [ config.environment.etc."resolvconf.conf".source ]; + serviceConfig.Type = "oneshot"; serviceConfig.RemainAfterExit = true; script = '' diff --git a/nixos/modules/services/networking/dhcpcd.nix b/nixos/modules/services/networking/dhcpcd.nix index a3bb591f535b..afc977583594 100644 --- a/nixos/modules/services/networking/dhcpcd.nix +++ b/nixos/modules/services/networking/dhcpcd.nix @@ -210,7 +210,8 @@ in { description = "DHCP Client"; wantedBy = [ "multi-user.target" ] ++ lib.optional (!hasDefaultGatewaySet) "network-online.target"; - wants = [ "network.target" ]; + wants = [ "network.target" "resolvconf.service" ]; + after = [ "resolvconf.service" ]; before = [ "network-online.target" ]; restartTriggers = [ cfg.runHook ];