Should Rocky Linux Enable NetworkManager‑wait‑online.service or Rely on network‑online.target for Service Startup Ordering?
0 reputation · 21 Jun 2021, 03:00 UTC
0 reputation · 21 Jun 2021, 03:00 UTC
Ensure that critical services in a Rocky Linux system only start once the network stack is fully operational, preventing repeated failures that appear in journalctl and systemctl status.
NetworkManager controls IP assignment, but its “wait‑online” feature is optional. Without it, units that declare After=network-online.target may start before an interface is up, leading to AVC denials or bind failures. Enabling NetworkManager-wait-online.service guarantees the target is reached but can add measurable delay to boot.
Both approaches are documented in the Rocky Linux systemd and NetworkManager manuals, yet the community has not reached consensus on which yields the most reliable ordering for production workloads.
NetworkManager-wait-online.service or relying solely on network-online.target—provides the most consistent startup for services that require a fully configured interface?NetworkManager-wait-online.service have on boot time in typical enterprise deployments?Wants=network-online.target without the wait service in Rocky Linux 9?Enable NetworkManager-wait-online.service. On Rocky Linux 9, network-online.target is a passive target. Without an active wait service, it can be reached before interfaces have addresses, so After=network-online.target does not guarantee that your network stack is ready.
NetworkManager-wait-online.service actively holds network-online.target until NetworkManager reports that the configured links are up. This makes the target a real synchronization point. In contrast, Wants=network-online.target alone only pulls the target into the transaction; it does not enforce ordering. You need both Wants= (or Requires=) and After= on the target, plus the wait service, to get strict sequencing.
Services that declare After=network-online.target but start before IP assignment will see bind failures or AVC denials. The race is most visible when DHCP is slow or when multiple interfaces initialize out of order.
The added delay is not a fixed penalty. It equals the time NetworkManager needs to configure the links. Static or fast-configured interfaces add little; slow DHCP, bonding, or Wi-Fi can add seconds. Measure on your own hardware rather than assuming a universal number.
The unit is provided by the NetworkManager package, but its default enabled state can vary by installation image. Verify before assuming it is active. If you use systemd-networkd instead of NetworkManager, the equivalent is systemd-networkd-wait-online.service.
systemctl is-enabled NetworkManager-wait-online.servicesystemctl status NetworkManager-wait-online.servicesystemd-analyze critical-chain network-online.targetsystemd-analyze blamejournalctl -u your-service.service -bReaching network-online.target does not guarantee full routability or DNS. Some services may still race with D-Bus or NetworkManager itself; order those dependencies explicitly if required. If your applications already retry connections internally, you can remove the target dependency and avoid the boot delay entirely.
If your critical services already implement robust connection retries, the wait service may be unnecessary; otherwise enable it.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.