Files
Athena-Deck/docs/experiments/wireguard-boot-fix-2026-10-13/README.md
T

42 lines
2.3 KiB
Markdown

# WireGuard DHCP startup race — 2026-10-13
The enabled `athena-deck-network.service` failed before activating its persisted
tunnel. Its fifth startup failure was at 11:42:06 CEST; dhcpcd assigned the
configured LAN address at 11:42:09.595 CEST. `networking.service` had completed
at 11:42:05 without waiting for the DHCP lease. The network helper initially
binds LAN listeners and treated every failure as a port collision. Thus a
missing address was reported as "port occupied", and rapid retries exhausted
systemd's default start limit before the address appeared.
## Fix
- `network.native.main` waits up to 60 seconds for the configured address on
the configured interface before constructing listeners.
- Binding errors distinguish address unavailability, occupied ports and other
listener failures without exposing credentials or raw configuration.
- A failed connection cleanup preserves the user's persisted activation;
explicit disconnect still disables it.
- Failed persisted-tunnel startup fails the service rather than leaving it
alive permanently without the tunnel, allowing systemd to retry.
- Native setup recipe: `RestartSec=5`, `StartLimitIntervalSec=0`.
- Existing host has matching overrides in
`/etc/systemd/system/athena-deck-network.service.d/boot-retry.conf`.
Only the failed network service was started; no host/Deck restart for this fix.
Tunnel configuration, keys, routes policy and access mode were not changed.
## Verification and restore
Ten native unit tests pass, including delayed address acquisition, bounded
wait, distinct bind errors and preservation of activation after a failed
connection. Installed source matches the tested code. The service is running,
the tunnel address 192.168.1.212 is present, its handshake is recent, and SSH
via this home address works. Deck is healthy. No second full reboot was
performed: actual next-boot verification is still pending.
On native restore, use the committed network code and setup recipe; existing
private tunnel configuration remains in its normal protected restore storage,
never Git. Keep the same policy and persisted enabled flag. Existing installs
can use the listed systemd overrides, daemon-reload and reset-failed before
starting the service. Do not silently fall back to broader network access.