问题
虚拟机安装ubuntu22.04 TLS系统后,开机总会卡在等待网络连接好长时间。
卡在 A start job is running for hait for Network to be Configured (1min 40s / no) 这里
如图所示
解决办法
进入系统后,打开终端,输入下面命令,
cd /etc/systemd/system/network-online.target.wants/
查看该文件夹,该文件夹下有个文件,systemd-networkd-wait-online.service
ll
total 8
lrwxrwxrwx 1 root root 56 Aug 9 2022 systemd-networkd-wait-online.service -> /lib/systemd/system/systemd-networkd-wait-online.service
在文件systemd-networkd-wait-online.service的service部分添加超时的字段
vim systemd-networkd-wait-online.service
[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
RemainAfterExit=yes
#添加上超时时间
TimeoutStartSec=2sec
[Install]
WantedBy=network-online.target
然后重启就好了
标签:systemd,network,service,Configured,running,online,networkd,wait From: https://www.cnblogs.com/guangdelw/p/17319166.html