[systemd-devel] Unable to get service to wait for a mount before starting
Adam Nielsen
a.nielsen at shikadi.net
Sun Nov 10 14:53:47 UTC 2024
> network-online.target by itself does absolutely nothing. You are
> expected to have some service that is ordered
> Before=network-online.target and actually waits until network is online.
> Standard network management applications that asynchronously configure
> interfaces (NetworkManager, systemd-networkd) have matching services.
> Some implementations (like SUSE wicked) are synchronous and
> network-online.target is effectively noop. Nothing stops you from
> creating your own service that performs custom checks.
I'm using systemd-networkd with a static configuration, i.e. my
*.network file contains:
[Network]
...
DNS=192.168.0.1 # local machine running BIND
DNS=192.168.0.2 # second local machine running BIND
I assumed systemd and networkd would play nice together without any
special configuration but it seems this is not the case.
I can see in the logs:
systemd-networkd[505]: eth0: Link UP
systemd-networkd[505]: eth0: Gained IPv6LL
Followed four seconds later by NFS mounts failing because they can't
resolve the hostname, and ntpd failing because it can't resolve the NTP
server hostname either.
systemd tries to restart ntpd nine seconds after that, and that time it
works.
Looking at the logs for systemd-resolved, it appears to be started at
the same second as the NFS mounts and ntpd, so I wonder if that's the
problem? The network-online.target doesn't actually wait for
systemd-resolved to have properly set up DNS?
Cheers,
Adam.
More information about the systemd-devel
mailing list