Skip to content

Commit

Permalink
dhcpcd service: order before network target
Browse files Browse the repository at this point in the history
This reverts a change applied in PR #18491. When interfaces are
configured by DHCP (typical in a cloud environment), ordering after
network.target cause trouble to applications expecting some network to
be present on boot (for example, cloud-init is quite brittle when
network hasn't been configured for `cloud-init.service`) and on
shutdown (for example, collectd needs to flush metrics on shutdown).

When ordering after network.target, we ensure applications relying on
network.target won't have any network reachability on boot and
potentially on shutdown.

Therefore, I think ordering before network.target is better.
  • Loading branch information
vincentbernat committed Aug 5, 2018
1 parent 8910795 commit 48f7778
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/dhcpcd.nix
Expand Up @@ -161,8 +161,8 @@ in
{ description = "DHCP Client";

wantedBy = [ "multi-user.target" ] ++ optional (!hasDefaultGatewaySet) "network-online.target";
after = [ "network.target" ];
wants = [ "network.target" ];
before = [ "network.target" ];

# Stopping dhcpcd during a reconfiguration is undesirable
# because it brings down the network interfaces configured by
Expand Down

1 comment on commit 48f7778

@vcunat
Copy link
Member

@vcunat vcunat commented on 48f7778 Aug 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this commit changes interface naming in the corresponding test, creating a channel blocker: https://hydra.nixos.org/job/nixos/unstable-small/nixos.tests.predictable-interface-names.predictable.x86_64-linux (there was one success on Hydra since, but did not manage to reproduce that one)

Please sign in to comment.