![systemd-networkd-wait-online 配置:关于 --any 的混淆](https://linux22.com/image/215385/systemd-networkd-wait-online%20%E9%85%8D%E7%BD%AE%EF%BC%9A%E5%85%B3%E4%BA%8E%20--any%20%E7%9A%84%E6%B7%B7%E6%B7%86.png)
uname -a
Linux meer 6.1.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 04 Jan 2023 16:28:15 +0000 x86_64 GNU/Linux
但这不是最近的问题。就这样“有一段时间了”——抱歉。
我有三个网络设备,我的网络需要 8 秒以上才能启动。
:> systemd-analyze blame
8.590s systemd-networkd-wait-online.service
我有一个wait-online
添加--any
标志的覆盖 - 我理解这意味着在第一次成功连接后将满足在线等待。
### Editing /etc/systemd/system/systemd-networkd-wait-online.service.d/override.
conf
### Anything between here and the comment below will become the new contents of
the file
[Service]
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any
我有三个 systemd.networkd 文件
> ls /etc/systemd/network/*.network
/etc/systemd/network/100-eno1.network - onboard ethernet
/etc/systemd/network/200-usb01.network - usb-ethernet
/etc/systemd/network/500-wlan0.network - wifi
我的理解是 systemd 按词法顺序读取这些文件 - 100,200,500 对吗?
然后这个日志片段显示,在读取 100 个文件之前,这 8 秒的大部分时间都花在了与 wifi 和 USB 以太网作斗争上,然后后板载以太网已启动,我们正在等待 wifi,然后等待 USB 以太网。
journalctl -b -u systemd-networkd -u systemd-networkd-wait-online.service
2023-01-07T07:01:11.167377-0800 meer systemd[1]: Starting Network Configuration...
2023-01-07T07:01:11.259477-0800 meer systemd-networkd[310]: lo: Link UP
2023-01-07T07:01:11.259482-0800 meer systemd-networkd[310]: lo: Gained carrier
2023-01-07T07:01:11.259789-0800 meer systemd-networkd[310]: Enumeration completed
2023-01-07T07:01:11.270757-0800 meer systemd[1]: Started Network Configuration.
2023-01-07T07:01:11.286993-0800 meer systemd[1]: Starting Wait for Network to be Configured...
2023-01-07T07:01:12.152228-0800 meer systemd-networkd-wait-online[351]: wlan0: Failed to update link state, ignoring: No such file or directory
2023-01-07T07:01:12.365857-0800 meer systemd-networkd-wait-online[351]: eth0: Failed to update link state, ignoring: No such file or directory
2023-01-07T07:01:12.454141-0800 meer systemd-networkd[310]: wlan0: found matching network '/etc/systemd/network/500-wlan0.network', based on potentially unpredictable inter>
2023-01-07T07:01:12.454149-0800 meer systemd-networkd[310]: wlan0: Configuring with /etc/systemd/network/500-wlan0.network.
2023-01-07T07:01:12.673305-0800 meer systemd-networkd[310]: eth0: Interface name change detected, renamed to eno1.
2023-01-07T07:01:12.673353-0800 meer systemd-networkd[310]: wlan0: Link UP
2023-01-07T07:01:12.674112-0800 meer systemd-networkd[310]: eno1: Configuring with /etc/systemd/network/100-eno1.network.
2023-01-07T07:01:12.860420-0800 meer systemd-networkd[310]: eno1: Link UP
2023-01-07T07:01:12.909088-0800 meer systemd-networkd[310]: wlan0: Link DOWN
2023-01-07T07:01:12.970441-0800 meer systemd-networkd-wait-online[351]: wlan0: Failed to update link state, ignoring: No such file or directory
2023-01-07T07:01:13.161606-0800 meer systemd-networkd[310]: wlan0: Link UP
2023-01-07T07:01:13.172932-0800 meer systemd-networkd[310]: wlan0: Configuring with /etc/systemd/network/500-wlan0.network.
2023-01-07T07:01:15.702912-0800 meer systemd-networkd[310]: eno1: Gained carrier
2023-01-07T07:01:17.130156-0800 meer systemd-networkd[310]: eno1: Gained IPv6LL
2023-01-07T07:01:17.815648-0800 meer systemd-networkd[310]: eno1: DHCPv6 address---
2023-01-07T07:01:18.091443-0800 meer systemd-networkd[310]: wlan0: Connected WiFi access point: Hymanwallace (f8:f5:32:7d:d3:db)
2023-01-07T07:01:18.212614-0800 meer systemd-networkd[310]: wlan0: Gained carrier
2023-01-07T07:01:19.233866-0800 meer systemd-networkd[310]: wlan0: Gained IPv6LL
2023-01-07T07:01:19.877409-0800 meer systemd[1]: Finished Wait for Network to be Configured.
2023-01-07T07:01:20.001854-0800 meer systemd-networkd[310]: wlan0: DHCPv6 address ---
2023-01-07T07:01:56.397053-0800 meer systemd-networkd[310]: eth0: Interface name change detected, renamed to usb01.
2023-01-07T07:01:56.461015-0800 meer systemd-networkd[310]: usb01: Configuring with /etc/systemd/network/200-usb01.network.
2023-01-07T07:01:56.468578-0800 meer systemd-networkd[310]: usb01: Link UP
2023-01-07T07:01:59.058539-0800 meer systemd-networkd[310]: usb01: Gained carrier
2023-01-07T07:02:00.886867-0800 meer systemd-networkd[310]: usb01: Gained IPv6LL
2023-01-07T07:02:01.996701-0800 meer systemd-networkd[310]: usb01: DHCPv6 address -----
~
我希望先读取 100 个文件,然后在启动后启动系统eno1
。
我的理解错误在哪里?如何更正配置?
答案1
ExecStart
在设置覆盖之前,您必须清除该参数。例如:
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any
参考这个回答
希望这可以帮助。