Skip to content
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

debian: fix network targets order for systemd unit #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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