Skip to content

Conversation

@sohorx
Copy link
Contributor

@sohorx sohorx commented May 16, 2023

This PR make network.target up after ifupdown2 is finished. Before this, no service would bring up network.target which is a main dependency for ordering services around network.

As explain in the systemd documentation1, network.target is not pulled by any services. Instead, it is pulled in by the network management service, which we are.

For further examples the ifupdown package (on bullseye) is bundled with this unit:

[Unit]
Description=Raise network interfaces
Documentation=man:interfaces(5)
DefaultDependencies=no
Requires=ifupdown-pre.service
Wants=network.target
After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service ifupdown-pre.service
Before=network.target shutdown.target network-online.target
Conflicts=shutdown.target

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/networking
ExecStart=/sbin/ifup -a --read-environment
ExecStop=/sbin/ifdown -a --read-environment --exclude=lo
RemainAfterExit=true
TimeoutStartSec=5min

And systemd-networkd also work by pulling in network.target.

Footnotes

  1. https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#conceptsinsystemd

As explain in the systemd documentation[^1], network.target is not
pulled any services. Instead, it is pulled in by the network management
service, wich we are.

[^1]: https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/#conceptsinsystemd
@sohorx
Copy link
Contributor Author

sohorx commented May 16, 2023

While I'm uncertain if this would cause issues with known services (except for some of mine), it's still preferable to do things correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant