Systemd 网络启动超时

Systemd 网络启动超时

我有一台 Debian(安装了 10,随着时间的推移升级到 12.4),其中安装了额外的 Proxmox 软件包。系统运行了几个月,没有出现问题。每天晚上,它都会停止rtcwake并在早上自动重新启动。每周一次在后台运行自动升级。

几天以来(我已经几个月没有登录主机了),系统没有通过网络响应。在启动过程中,它挂在“网络”上。我不使用 NetworkManager 或 systemd-networkd。

通过救援启动,我在网络服务上设置了 TimeoutOnStart(首先是 30 秒,然后是 300 秒,现在是 10 秒)。然后系统启动了,但当然没有网络。这个错误没什么帮助

$> journalctl -xeu networking
Defined-By: systemd
Support: https://www.debian.org/support

A start job for unit networking.service has begun execution.

The job identifier is 31.
Dez 17 17:23:17 saturn networking[1269]: networking: Configuring network interfaces
Dez 17 17:28:17 saturn systemd[1]: networking.service: start operation timed out. Terminating.
Dez 17 17:28:17 saturn systemd[1]: networking.service: Main process exited, code=killed, status=15/TERM
Subject: Unit process exited
Defined-By: systemd
Support: https://www.debian.org/support

An ExecStart= process belonging to unit networking.service has exited.

The process' exit code is 'killed' and its exit status is 15.
Dez 17 17:28:47 saturn systemd[1]: networking.service: State 'final-sigterm' timed out. Killing.
Dez 17 17:28:47 saturn systemd[1]: networking.service: Killing process 1383 (python3) with signal SIGKILL.
Dez 17 17:28:47 saturn systemd[1]: networking.service: Failed with result 'timeout'.
Subject: Unit failed

登录 im 后,当我通过 启动时systemctl start networking,网络启动并按预期工作。启动网络大约需要 1 秒。我不明白或找不到根本原因。有什么提示吗?

这里有一些附加信息。我们讨论 Onboard-Ethernet eno1 和简单的 Proxmox Bridge 设置。

# /etc/network/interfaces
auto lo
iface lo inet loopback

auto eno1
iface eno1 inet manual

iface eno1 inet6 auto

auto vmbr0
iface vmbr0 inet static
    address 192.168.10.2/24
    gateway 192.168.10.254
    bridge-ports eno1
    bridge-stp off
    bridge-fd 0
    dns-nameservers 192.168.10.254

我已经添加了超时设置,否则系统会在启动时挂起(甚至等待 10 分钟)

# /etc/systemd/system/network-online.target.wants/networking.service
[Unit]
Description=Network initialization
Documentation=man:interfaces(5) man:ifup(8) man:ifdown(8)
DefaultDependencies=no
After=local-fs.target network-pre.target
Before=shutdown.target network.target network-online.target
Conflicts=shutdown.target
Requires=ifupdown2-pre.service
Wants=network.target
After=local-fs.target network-pre.target systemd-sysctl.service systemd-modules-load.service ifupdown2-pre.service

[Service]
Type=oneshot
RemainAfterExit=yes
SyslogIdentifier=networking
TimeoutStartSec=10s
TimeoutStopSec=10s
EnvironmentFile=/etc/default/networking
ExecStart=/usr/share/ifupdown2/sbin/start-networking start
ExecStop=/usr/share/ifupdown2/sbin/start-networking stop
ExecReload=/usr/share/ifupdown2/sbin/start-networking reload

[Install]
WantedBy=multi-user.target network-online.target

如上所述,NetworkManager 已禁用,networkd 未安装,这是经典的网络设置(我猜)。我在其他地方没有找到任何其他日志消息。

相关内容