#1037559 systemd-networkd-wait-online waits undefinitely if no networkd managed interfaces

Package:
systemd
Source:
systemd
Description:
system and service manager
Submitter:
Mo
Date:
2023-08-22 09:42:03 UTC
Severity:
normal
Tags:
#1037559#5
Date:
2023-06-14 08:10:16 UTC
From:
To:
Dear Maintainer,

after upgrade to debian 12 from debian 11, the system boots using almost ~2min
to prompt login.

after check for systemd-analyze, get info:

root@vm:~# systemd-analyze time
Startup finished in 2.246s (kernel) + 2min 3.788s (userspace) = 2min 6.035s
graphical.target reached after 2min 3.610s in userspace.

root@vm:~# systemd-analyze blame
2min 189ms systemd-networkd-wait-online.service
    4.253s kdump-tools.service
    1.910s apparmor.service
    1.267s ifupdown-pre.service
    ...

in my machine there is not using systemd-networked, and no interfaces managed by
networkd.

so i search for it online, and there was an issue in systemd's github:
systemd-networkd-wait-online waits undefinitely if no networkd managed interfaces
https://github.com/systemd/systemd/issues/25813

and fixed in systemd 253, with release note:

      systemd-networkd-wait-online exits successfully when all interfaces
      are ready or unmanaged. Previously, if neither '--any' nor
      '--interface=' options were used, at least one interface had to be in
      configured state. This change allows the case where systemd-networkd
      is enabled, but no interfaces are configured, to be handled
      gracefully. It may occur in particular when a different network
      manager is also enabled and used.

so i try to install systemd 253 from experimental, it fixes the long boot.

please consider patch it to debian 12 bookworm, thanks.

#1037559#10
Date:
2023-06-14 08:42:06 UTC
From:
To:
Control: tags -1 moreinfo
almost ~2min
6.035s
managed by

Then why is systemd-networkd-wait-online being pulled in? Did you
enable it or one of the targets that pull it in? If it's not in use as
you say, it should not run in the first place.

#1037559#17
Date:
2023-06-14 14:08:41 UTC
From:
To:
(On behalf of alim0x@outlook.com as he is facing some network problem)

Thanks for your hint, this problem original happened in my cloud
machine, so I checked again.

In my local fresh install of Debian 11, the networkd and
system-networkd-wait-online
services are disabled by default.

So I create a new cloud machine, I found the vm image the vps provider
provided has these system unit file settings default although the
system didn’t using networkd:

systemd-network-generator.service         disabled        disabled
systemd-networkd-wait-online.service    enabled         disabled
systemd-networkd.service                        enabled         enabled

so it’s maybe will not happen in users who install Debian in local
machine, but will happen
in users who using the system image from vps provider. There maybe
enabled multiple network manager.

Of course there can be a solution that require cloud service provider
provide system image with “correct config”. But this problem could
also happened in users who try to switch network manager or switch
back then forget to disable network manager that is unused.

Since upstream(systemd) take it as a bug, I think it also can be patch
into current stable package.

Thanks.

#1037559#22
Date:
2023-06-16 08:56:24 UTC
From:
To:
On first boot systemd uses presets (systemd.preset(5)) to configure the
enable/disable state of services. By default, systemd-networkd.service
is enabled via presets and this pulls in
systemd-networkd-wait-online.service automatically as well, while
ifupdown provides an `ifupdown-wait-online.service` alternative which
also satisfies `network-online.target`.

Given that debian defaults to ifupdown, I wonder if debian's systemd
packaging should by default set the systemd-networkd.service preset
state to disabled? (It'll only affect first boots and explicit calls to
`systemctl preset`).

In any case, container providers may want to deal with this either in
their templates or when starting up containers.
We also ran into this with bookworm templates in Proxmox VE and generate
a preset file[1] for this now to debian containers.

[1] https://git.proxmox.com/?p=pve-container.git;a=commit;h=e11806e0de064e6570d40e7c04bc4656687b2c62

#1037559#35
Date:
2023-08-22 09:38:36 UTC
From:
To:

Please ask on the upstream bug tracker for a stable backport for
v252-stable.

Regards,
Michael