无风扇 2 以太网 PC 上的 Ubuntu 服务器(网络配置)启动时间非常长:systemd-networkd-wait-online.service

无风扇 2 以太网 PC 上的 Ubuntu 服务器(网络配置)启动时间非常长:systemd-networkd-wait-online.service

我是 Unbuntu Server 22.04.2 的新手,启动时间很长。

我使用一台小型无风扇 I3 PC,配有 2 个以太网和 WIFI。我只使用一个以太网。

我的第一次调查是为了提取以下信息:

在启动时我有提取:

sudo journalctl -b
Nov 01 12:35:40 hsm3 systemd-timesyncd[630]: Network configuration changed, trying to establish connection.
Nov 01 12:35:41 hsm3 systemd-networkd-wait-online[668]: Timeout occurred while waiting for network connectivity.
Nov 01 12:35:41 hsm3 systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE

我尝试通过添加可选:true 来更改网络计划,但没有成功:

sudo nano /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'
network:
  ethernets:
    enp2s0:
      dhcp4: true
      optional: true
    enp3s0:
      dhcp4: true
      optional: true
  version: 2

最后我找到了一个让我不满意的扭转局面的解决方案。添加超时!该命令仍然会产生问题,但我不会等待超过 5 秒 --timeout=5:

sudo systemctl edit --full 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

[Service]
Type=oneshot
ExecStart=/lib/systemd/systemd-networkd-wait-online --timeout=5
RemainAfterExit=yes

[Install]
WantedBy=network-online.target

但我不喜欢这种“非解决方案”。

你能帮我解决根本问题吗?

向所有人致敬


使用版本 22.04.03 LTS 更新后结果相同:

Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-88-generic x86_64)

:~$ sudo apt update
Hit:1 http://fr.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://fr.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://fr.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://fr.archive.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.


hsm@hsm3:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

日志提取:

Nov 01 18:58:46 hsm3 systemd[1]: systemd-rfkill.service: Deactivated successfully.
Nov 01 18:58:47 hsm3 systemd-networkd[663]: enp2s0: Gained IPv6LL
Nov 01 18:58:47 hsm3 systemd-timesyncd[627]: Network configuration changed, trying to establish connection.
Nov 01 18:58:48 hsm3 systemd-networkd-wait-online[664]: Timeout occurred while waiting for network connectivity.
Nov 01 18:58:48 hsm3 systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Nov 01 18:58:48 hsm3 systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Nov 01 18:58:48 hsm3 systemd[1]: Failed to start Wait for Network to be Configured.
Nov 01 18:58:48 hsm3 systemd-timesyncd[627]: Network configuration changed, trying to establish connection.
Nov 01 18:58:48 hsm3 systemd[1]: Starting Initial cloud-init job (metadata service crawler)...

我还有第二台电脑,我在上面安装了版本 23.10,结果相同。

还有其他想法吗?

问候

相关内容