Tas*_*man 4 init.d ntp amazon-ec2 systemd 16.04
ntp.service
我正在将系统从 14.04 升级到 16.04,我面临着无法启动的问题。
$ sudo systemctl status ntp.service\n\xe2\x97\x8f ntp.service - LSB: Start NTP daemon\n Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)\n Active: active (exited) since Mon 2017-09-11 12:29:11 UTC; 26min ago\n Docs: man:systemd-sysv-generator(8)\n Tasks: 0\n Memory: 0B\n CPU: 0\n\nSep 11 12:29:11 ip-10-1-1-20 systemd[1]: Starting LSB: Start NTP daemon...\nSep 11 12:29:11 ip-10-1-1-20 ntp[1254]: * Starting NTP server ntpd\nSep 11 12:29:11 ip-10-1-1-20 ntp[1254]: ...done.\nSep 11 12:29:11 ip-10-1-1-20 systemd[1]: Started LSB: Start NTP daemon.\nSep 11 12:29:11 ip-10-1-1-20 ntpd[1372]: proto: precision = 0.222 usec (-22)\n
Run Code Online (Sandbox Code Playgroud)\n\n如果我没记错的话,文件的内容ntp.service
是由服务生成的。sysv
其内容为
$ sudo systemctl cat ntp.service\n# /run/systemd/generator.late/ntp.service\n# Automatically generated by systemd-sysv-generator\n\n[Unit]\nDocumentation=man:systemd-sysv-generator(8)\nSourcePath=/etc/init.d/ntp\nDescription=LSB: Start NTP daemon\nBefore=multi-user.target\nBefore=multi-user.target\nBefore=multi-user.target\nBefore=graphical.target\nAfter=network-online.target\nAfter=remote-fs.target\nAfter=systemd-journald-dev-log.socket\nWants=network-online.target\n\n[Service]\nType=forking\nRestart=no\nTimeoutSec=5min\nIgnoreSIGPIPE=no\nKillMode=process\nGuessMainPID=no\nRemainAfterExit=yes\nExecStart=/etc/init.d/ntp start\nExecStop=/etc/init.d/ntp stop\n
Run Code Online (Sandbox Code Playgroud)\n\n相关错误文件:
\n\n我在 IRC 中询问,他们说,从 init 服务到 systemd 服务文件的系统生成文件有时有问题,并要求我从 ntp.service 的上游版本之一替换它。
\n\n现在,我能想到的解决办法是我必须手动启动和停止 ntpd 服务
\n\n$ sudo systemctl stop ntp.service\n$ sudo systemctl start ntp.service\n
Run Code Online (Sandbox Code Playgroud)\n\n但这违背了开机时自动启动ntp.service的目的
\n\n对此有任何帮助将不胜感激。
\n从 Ubuntu 16.04 开始,ntp服务已被名为systemd-timesyncd(或Preferred-timesyncd)的本机 systemd 服务取代,并且默认情况下运行。
如果您只想要 NTP 同步时钟,请禁用ntp.service并用于timedatectl status
检查状态:
lar@rv-server:~$ timedatectl status
Local time: Fri 2018-11-09 14:16:52 PST
Universal time: Fri 2018-11-09 22:16:52 UTC
RTC time: n/a
Time zone: America/Los_Angeles (PST, -0800)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Run Code Online (Sandbox Code Playgroud)
如果 NTP 未同步,请使用sudo timedatectl set-ntp on
将其打开。
对于 NTP 服务器(不仅仅是客户端),您需要将timedatectl替换为ntpd或安装chrony(推荐)。
在这里阅读更多信息: https: //help.ubuntu.com/lts/serverguide/NTP.html
归档时间: |
|
查看次数: |
20306 次 |
最近记录: |