共计 437 个字符,预计需要 2 分钟阅读。
问题表现
如题,开机时会花费1分钟以上在Network Configuration
这项任务上,如下图。这对于重启说很不便捷,故想办法优化一下。

分析
使用如下命令列出开机耗时
systemd-analyze blame
如下图,经过的排查,这是可能的耗时项。

解决方法
方法1
只需要给这个网络配置服务一个超时时间即可。查找到它的配置文件目录在/etc/systemd/system/network-online.target.wants/,修改一下其中的配置即可。
#切换到目录
cd /etc/systemd/system/network-online.target.wants/
#列出文件
ll

我们需要配置的是这个systemd管理文件,使用vim
或其他编辑器,在[Service]
块中添加一个TimeoutStartSec=2sec
超时命令即可。

之后重启即可,未出现再次耗时长的问题。
方法2
检查本机的网卡网络配置的初始值是否有错误,改正后应当就不会出现这样的问题了。
正文完
学习了 爱钻研