-
-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wireguard: fail to start peers due dns resolution failure #260402
Comments
Disclaimer: I've only been using NixOS for 2 days... I'm also having this issue on 23.11 on my laptop:
The problem could be related to the service being of type "oneshot": nixos/modules/services/networking/wg-quick.nix I'm using the instructions from https://nixos.wiki/wiki/WireGuard in the "Setting up WireGuard server/client with wg-quick and dnsmasq" I fixed it by adding this to my nix config:
Not sure if that's the 'right' way to fix it, but it works, hope that helps someone! Would it make sense to update the nix module from oneshot to exec? According to the systemd docs: "It is recommended to use Type=exec for long-running services, as it ensures that process setup errors [...] Also note it is generally not recommended to use idle or oneshot for long-running services." |
This was happening because dhcpcd was trying to run on the wireguard interface, which was leading to `network-online.target` coming up prematurely. See NixOS/nixpkgs#260402 for details
Describe the bug
Some times, my wireguard peers fail to start at boot time due to dns resolution failure
Steps To Reproduce
networking.wireguard.interfaces
. The more interfaces the more likely you will reproduce the bug. On my machine, 2 interfaces were enough to reproduce the bug.systemctl list-units --failed
shows your wireguard peers fail to startExpected behavior
The peer should start successfully at every boot.
Additional context
The issue is explained in detailed at https://discourse.nixos.org/t/name-resolution-fails-at-boot-time/33867 but here is a simplified explanation.
The existence of the Wireguard interfaces leads to premature reach of
network-online.target
. The wireguard peers are started immediately afternetwork-online.target
is reached but they fail because the network is not actually online yet.To work around the issue, meaning: to prevent
dhcpcd
from leading to premature reach ofnetwork-online.target
, there are a few possibilities:networking.dhcpcd.denyInterfaces
hardware-configuration.nix
The result:
May be related to #171079, #63869
Notify maintainers
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: