about summary refs log tree commit diff
diff options
context:
space:
mode:
authorillustris <rharikrishnan95@gmail.com>2024-01-03 23:37:02 +0530
committerillustris <rharikrishnan95@gmail.com>2024-01-03 23:50:30 +0530
commitd6baaf1c42b41d5a43ff196bdbe10cf5864f87be (patch)
tree86be48c9a6cb3a6eff925103036c0d66f55a4583
parentc8144bb5975693f385b11078421377f7bfca1fd8 (diff)
downloadnixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar.gz
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar.bz2
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar.lz
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar.xz
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.tar.zst
nixlib-d6baaf1c42b41d5a43ff196bdbe10cf5864f87be.zip
nixos/cloud-init: fix DHCP race condition
-rw-r--r--nixos/modules/services/system/cloud-init.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/services/system/cloud-init.nix b/nixos/modules/services/system/cloud-init.nix
index d782bb1a3666..00ae77be4271 100644
--- a/nixos/modules/services/system/cloud-init.nix
+++ b/nixos/modules/services/system/cloud-init.nix
@@ -164,7 +164,10 @@ in
     systemd.services.cloud-init-local = {
       description = "Initial cloud-init job (pre-networking)";
       wantedBy = [ "multi-user.target" ];
-      before = [ "systemd-networkd.service" ];
+      # In certain environments (AWS for example), cloud-init-local will
+      # first configure an IP through DHCP, and later delete it.
+      # This can cause race conditions with anything else trying to set IP through DHCP.
+      before = [ "systemd-networkd.service" "dhcpcd.service" ];
       path = path;
       serviceConfig = {
         Type = "oneshot";