Skip to content

Order ufw.service before network-pre.target instead of sysinit.target - #19889

Merged
dhh merged 1 commit into
quattrofrom
boot-ufw-ordering
Nov 23, 2026
Merged

dhh merged 1 commit into
quattrofrom
boot-ufw-ordering

Conversation

@dhh

@dhh dhh commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

What changes

  • Ship etc/systemd/system/ufw.service ordered Before=network-pre.target with Wants=network-pre.target instead of Before=sysinit.target.
  • Upstream orders ufw.service before sysinit.target, blocking sysinit.target, basic.target, and display manager startup for ~350–780ms on every boot.
  • Ordering before network-pre.target (the standard systemd.special(7) firewall target) still guarantees netfilter rules load strictly before NetworkManager.service, systemd-networkd.service, and tailscaled.service (After=network-pre.target) bring up any interface, while letting local boot proceed in parallel.
  • Shipped as a full unit override rather than a drop-in because systemd does not allow clearing Before= in a drop-in (systemd.unit(5)).

Verification

  • Verified with systemd-analyze --root=... verify against ufw.service, NetworkManager.service, sysinit.target, multi-user.target, and graphical.target: parsed unit has Before: network-pre.target and Wants: network-pre.target without Before: sysinit.target, and zero ordering cycles.

Screenshots

No visible change: boot-time systemd unit ordering optimization only.

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable regression was found.

Summary

Adds a full ufw.service override that replaces Before=sysinit.target with ordering before network-pre.target.

  • UFW loads its rules before network setup while local boot continues.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["systemd-sysctl.service"] -->|before| B["ufw.service"]
  B -->|before| C["network-pre.target"]
  B -.->|wants| C
Loading

Reviews (1) · Last reviewed commit: "Order ufw.service before network-pre.tar..." · Reviewed by Greptile

@omarchybot omarchybot added the enhancement New feature or request label Nov 23, 2026
@dhh
dhh merged commit 3aab775 into quattro Nov 23, 2026
2 of 4 checks passed
@dhh
dhh deleted the boot-ufw-ordering branch November 23, 2026 10:03
@emirb emirb added this to the 4.6.0 milestone Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants