#1111791 systemd: network-online.target reached before IPv6 address is ready

Package:
systemd
Source:
systemd
Description:
system and service manager
Submitter:
Marcelo Gondim
Date:
2025-08-29 21:05:02 UTC
Severity:
normal
Tags:
#1111791#5
Date:
2025-08-21 22:37:37 UTC
From:
To:

#1111791#10
Date:
2025-08-22 10:15:30 UTC
From:
To:
You can configure it to wait for what you want as per documentation:

https://www.freedesktop.org/software/systemd/man/latest/systemd-networkd-wait-online.service.html

#1111791#21
Date:
2025-08-22 12:01:42 UTC
From:
To:
Hi,

I see, that would be a workaround. But do you have any idea why this
only started happening in Trixie?

#1111791#26
Date:
2025-08-22 12:50:48 UTC
From:
To:
If you are using /etc/network/interfaces, is the interface even being
managed by systemd-networkd? The output of:

$ networkctl
$ SYSTEMD_LOG_LEVEL=debug /usr/lib/systemd/systemd-networkd-wait-online

would help you determine if systemd-networkd-wait-online is even at play here.

Otherwise, if you are using ifupdown, then you need to look at
/usr/lib/systemd/system/networking.service from ifupdown. If that
service is completing before your IPv6 address is ready, then other
services cannot reliably synchronize on network-online.target.

$ systemctl list-dependencies --after network-online.target

will show you what specific units are ordered Before=network-online.target.

#1111791#31
Date:
2025-08-22 13:55:27 UTC
From:
To:
Hi,

I compared the files /usr/lib/systemd/system/networking.service from
Bookworm and Trixie and there was no significant change, only what used
to be /sbin/... was changed to /usr/sbin/... in Trixie.

You are right, I’m using Debian’s default for network interfaces, ifupdown:

# networkctl
systemd-networkd is not running, output might be incomplete.
IDX LINK  TYPE     OPERATIONAL SETUP
   1 lo    loopback -           unmanaged
   2 ens18 ether    -           unmanaged
   3 ens20 ether    -           unmanaged

3 links listed.

# systemctl list-dependencies --after network-online.target
network-online.target
● ├─networking.service
● └─network.target
●   ├─ifupdown-pre.service
●   ├─networking.service
○   ├─systemd-networkd.service
○   └─network-pre.target

#1111791#36
Date:
2025-08-22 15:09:37 UTC
From:
To:
Hi All,

I tested here by switching from ifupdown to systemd-networkd and the
system worked perfectly. Do you recommend that I start using
systemd-networkd on the servers instead of ifupdown?

# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier configured
2 ens18 ether routable configured
3 ens20 ether routable configured

3 links listed.

#1111791#46
Date:
2025-08-27 14:06:54 UTC
From:
To:
Note that the default behavior of systemd-networkd-wait-online is to
wait for any protocol to be configured.  If you want to specifically
require IPv6, you'll need to pass `--ipv6` via the commandline (using a
systemd drop-in, probably) or add `RequiredFamilyForOnline=ipv6` to the
interface's [Link] section.  Otherwise you're just getting lucky that
this is working for you, probably just based on timing of some
configuration events.

noah

#1111791#51
Date:
2025-08-27 14:32:32 UTC
From:
To:
Before systemd-networkd-wait-online looks at configured address
families, it waits for the link state to be "configured". If a static
IPv6 address is requested in the configuration, the link state will
not be "configured" until the static address is set.

#1111791#56
Date:
2025-08-27 14:55:16 UTC
From:
To:
Yes, that's correct. I missed the static configuration detail earlier.
What I wrote pertains to dynamic assignment.

noah

#1111791#61
Date:
2025-08-29 21:02:28 UTC
From:
To:
Hi,

Based on my tests, I conclude that the issue is not related to systemd
itself, but rather to the ifupdown package. When using systemd-networkd
instead of ifupdown, everything operates normally.

It seems that something introduced between Bookworm and Trixie caused
ifupdown (/etc/network/interfaces) to change its behavior, leading to
services being started before the network is fully ready.