fuck systemd-networkd-wait-online.service: "start job is running for wait for network to be configured"
scriptk1d
fuck systemd-networkd-wait-online.service: “start job is running for wait for network to be configured”
When using Ubuntu, I have encountered this kind of situation many times.
It looks like the image shown.
After booting into the system, you can see through systemd-analyze blame that the startup time of systemd-networkd-wait-online.service reaches several minutes.
r00t@f4keserver:~$ sudo systemctl status systemd-networkd-wait-online.service ● systemd-networkd-wait-online.service - Wait for Network to be Configured Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; enabled-runtime; vendor preset: disabled) Active: active (exited) since Mon 2024-01-15 03:36:01 UTC; 12min ago Docs: man:systemd-networkd-wait-online.service(8) Main PID: 624 (code=exited, status=0/SUCCESS) CPU: 4ms
Jan 15 03:35:56 f4keserver systemd[1]: Starting Wait for Network to be Configured... Jan 15 03:36:01 f4keserver systemd-networkd-wait-online[624]: managing: ens33 Jan 15 03:36:01 f4keserver systemd[1]: Finished Wait for Network to be Configured.
r00t@f4keserver:~$ cat /lib/systemd/system/systemd-networkd-wait-online.service # SPDX-License-Identifier: LGPL-2.1-or-later # # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version.
[Unit] Description=Wait for Network to be Configured Documentation=man:systemd-networkd-wait-online.service(8) DefaultDependencies=no Conflicts=shutdown.target Requires=systemd-networkd.service After=systemd-networkd.service Before=network-online.target shutdown.target
You can see that there is a timeout parameter for /lib/systemd/systemd-networkd-wait-online. This means you can add the argument --timeout=1 in the corresponding systemd-networkd-wait-online service file, indicating a timeout of 1 second.
-h --help Show this help --version Print version string -q --quiet Do not show status information -i --interface=INTERFACE[:MIN_OPERSTATE[:MAX_OPERSTATE]] Block until at least these interfaces have appeared --ignore=INTERFACE Don't take these interfaces into account -o --operational-state=MIN_OPERSTATE[:MAX_OPERSTATE] Required operational state -4 --ipv4 Requires at least one IPv4 address -6 --ipv6 Requires at least one IPv6 address --any Wait until at least one of the interfaces is online --timeout=SECS Maximum time to wait for network connectivity See the systemd-networkd-wait-online.service(8) man page for details.
[Unit] Description=Wait for Network to be Configured Documentation=man:systemd-networkd-wait-online.service(8) DefaultDependencies=no Conflicts=shutdown.target Requires=systemd-networkd.service After=systemd-networkd.service Before=network-online.target shutdown.target