From e8897af7537d60b8799be1fe6f6c1bfea7c2066e Mon Sep 17 00:00:00 2001 From: Bojan Smojver Date: Thu, 5 Mar 2026 03:56:52 +0000 Subject: [PATCH] Fix network ordering in codedeploy-agent.service The [Unit] section was missing Wants= and After= for network-online.target and nss-lookup.target, meaning the agent could start before DNS is available. The existing After=network.target in [Service] had no effect as After= is a [Unit] directive and is silently ignored in [Service]. This fixes a boot-time race condition where the agent exits with SocketError on the CodeDeploy commands endpoint before DNS is ready. --- init.d/codedeploy-agent.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.d/codedeploy-agent.service b/init.d/codedeploy-agent.service index 72a47342..7b62eb6e 100644 --- a/init.d/codedeploy-agent.service +++ b/init.d/codedeploy-agent.service @@ -1,9 +1,10 @@ [Unit] Description=AWS CodeDeploy Host Agent +Wants=network-online.target nss-lookup.target +After=network-online.target nss-lookup.target [Service] Type=forking -After=network.target ExecStart=/bin/bash -a -c '[ -f /etc/profile ] && source /etc/profile; /opt/codedeploy-agent/bin/codedeploy-agent start' ExecStop=/opt/codedeploy-agent/bin/codedeploy-agent stop RemainAfterExit=no