WIFI环境下开机ntp服务异常

系统信息

  • CPU:X5570
  • OS:openSUSE Tumbleweed lastest

异常描述

系统加载*.service时,出现错误:

(1 of 3) A start job is running for Update cron periods from /etc/sysconfig/btrfsmaintenance (29s / no limit)
(2 of 3) A start job is running for Wait for chrony to synchronize system clock (30s / no limit)
(3 of 3) A start job is running for Hold until boot process finishes up (31s / no limit)

然后一直在这里等待.无法完成引导
前几个个成功加载的service

Starting e[0;1;39m]Network Manager Script Dispatcher Servicee[0m...
[e[0;32m]  OK  e[0m] Started e[0;1;39mNetwork Manager Script Dispatcher Servicee[0m.
[e[0;32m]  OK  e[0m] Started e[0;1;39mOpenSSH Daemone[0m.
         Starting e[0;1;39m]WPA Supplicant daemone[0m...
[e[0;32m]  OK  e[0m] Started e[0;1;39mWPA Supplicant daemon

据此推测应该是启动了network manager之后,ntpd也就是chrony这货误以为系统此时成功联网,就去对时了,然而并没有网络连接.
这个通过查看/cat /etc/systemd/system/multi-user.target.wants/chronyd.service看出

After=network.target

解决

此解决方案为本人的一得之见,如果有更好的解决方式的话欢迎提出

Plan A

找个地方插上网线,开机之后在yast里面时区选项那里使用手动对时的方式,并且

sudo disable chronyd
sudo disable chrony-wait

Plan B

如果你和我一样不想抱电脑并且手里面有救援系统的话

进入救援系统,并且挂载根目录
然后重命名这两个服务:

mv /etc/systemd/system/multi-user.target.wants/chronyd.service /etc/systemd/system/multi-user.target.wants/chronyd.service.bak
mv /etc/systemd/system/multi-user.target.wants/chrony-wait.service /etc/systemd/system/multi-user.target.wants/chrony-wait.service.bak

当然,我这个是保险起见对这两个开机服务重命名了,也可以将其删除

如果你不确定此服务是否在此目录中,可以在根目录里面find . -name "*chrony*.service" 开机之后去yast`里面禁用自动对时

End

这个似乎是一个逻辑问题
chrony:诶! wpa_support你起来了啊,那我也去请求一下网络连接
wpa_support:Emm,我起来不代表我联网了啊!

1赞

有一个 network-oneline.target,试试?

network-oneline.target而不是network-online.target?

此方案在我的系统下并不可行。
我发现我的梯子的service可以做到开机自启而不会造成卡死系统加载,但是我不是太会systemd,不清楚如何修改,你可以帮我吗?

[Unit]
Description=V2Ray Service
After=network.target
Wants=network.target

[Service]
# This service runs as root. You may consider to run it as another user for security concerns.
# By uncommenting the following two lines, this service will run as user v2ray/v2ray.
# More discussion at https://github.com/v2ray/v2ray-core/issues/1011
# User=v2ray
# Group=v2ray
Type=simple
PIDFile=/run/v2ray.pid
ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json
Restart=on-failure
# Don't restart in the case of configuration error
RestartPreventExitStatus=23

[Install]
WantedBy=multi-user.target

以上是梯子的service

[Unit]
Description=NTP client/server
Documentation=man:chronyd(8) man:chrony.conf(5)
After=nss-lookup.target
Wants=network-online.target
After=network-online.target
Wants=time-sync.target
Before=time-sync.target
Conflicts=ntpd.service systemd-timesyncd.service
ConditionCapability=CAP_SYS_TIME

[Service]
Type=forking
PIDFile=/var/run/chrony/chronyd.pid
EnvironmentFile=-/etc/sysconfig/chronyd
ExecStart=/usr/sbin/chronyd $OPTIONS
ExecStartPost=/usr/lib/chrony/helper update-daemon
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=full

[Install]
WantedBy=multi-user.target

以上是chrony的service

试试我的通用版 network-online.target?