问题现象
系统:CTyunOS 2.0.1
主机12个小时之前重启过,chronyd没起且ntpd有开机自启配置,但是ntpd没有自动起来:
排查
1.确认chronyd和ntpd的开机启动状态
systemctl is-enabled ntpd
enabled
systemctl is-enabled chronyd
disabled
chronyd未安装,ntpd配置了开机启动。
2.查看messages日志
未发现启动的记录,也没有启动失败的异常。
3.查看服务配置
cat /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=syslog.target ntpdate.service sntp.service
Conflicts=systemd-timesyncd.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/ntpd
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
PrivateTmp=true
[Install]
WantedBy=multi-user.target
即ntpd与systemd-timesyncd.service也是配置了冲突的。
解决方案
1、确认ntpd配置的与systemd-timesyncd互斥,且systemd-timesyncd、ntpd都是被开机启用的:
systemctl is-enabled ntpd systemd-timesyncd
enabled
enabled
grep ^Conflicts /usr/lib/systemd/system/ntpd.service
Conflicts=systemd-timesyncd.service
2、若与上述结果一致,且需要使用ntpd,则停掉systemd-timesyncd的开机启动
systemctl disable systemd-timesyncd
扩展资料
CTyunOS 2.0.1中ntp的默认配置
1、在开机启动的时候:
如果ntpd的互斥项配置为(CTyunOS 2.0.1官方镜像默认配置):
Conflicts=chronyd.service systemd-timesyncd.service
则ntpd和systemd-timesyncd能被同时拉起。
可能是个bug,待确认。。
如果只配置为:
Conflicts=systemd-timesyncd.service
则只有systemd-timesyncd被拉起。
ntpd状态为:
[root@localhost ~]# systemctl status ntpd
● ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
Active: inactive (dead)
2、在配置为:
Conflicts=chronyd.service systemd-timesyncd.service
的状态,两个都正常启动后,重启ntpd,能停掉systemd-timesyncd.service,即也识别出了互斥项。
service配置不一样问题
安装了欧拉版本:
正常版本:
[root@localhost ~]# rpm -qa |grep ntp
ntp-4.2.8p14-5.ctl2.x86_64
ntpstat-help-0.6-2.ctl2.noarch
ntpstat-0.6-2.ctl2.noarch
ntp-help-4.2.8p14-5.ctl2.noarch