大网数据广告活动
服务器运维问答

NTP - Disable timesyncd and enable NTP

· 52CE 我爱测

I have installed ntp on ubuntu 16.04 but when I run timedatectl it doesn't show NTP. It shows systemd-timesyncd in the output. I ran the command sudo systemctl disable systemd-timesyncd; sudo systemctl stop systemd-timesyncd; sud…

问题原文

原帖链接 · John doe · CC BY-SA 4.0

I have installed ntp on ubuntu 16.04 but when I run timedatectl it doesn't show NTP. It shows systemd-timesyncd in the output.

I ran the command sudo systemctl disable systemd-timesyncd; sudo systemctl stop systemd-timesyncd; sudo systemctl enable ntp;

How do I set ntp for timedatectl?

I even tried timedatectl set-ntp true but still it doesn't show under timedatectl output.

root@host001:~# timedatectl
                      Local time: Fri 2020-05-08 16:00:59 UTC
                  Universal time: Fri 2020-05-08 16:00:59 UTC
                        RTC time: Fri 2020-05-08 16:00:59
                       Time zone: UTC (UTC, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: no
                 RTC in local TZ: no

I was expecting output like below (as seen in others post) where NTP is shown instead of systemd-timesyncd

                      Local time: Fri 2020-05-08 16:00:59 UTC
                  Universal time: Fri 2020-05-08 16:00:59 UTC
                        RTC time: Fri 2020-05-08 16:00:59
                       Time zone: UTC (UTC, +0000)
                       Network time on: no
                       NTP synchronized: yes
                       RTC in local TZ: no

已采纳解答

原帖链接 · John Mahowald · CC BY-SA 4.0

systemctl disable --now systemd-timesyncd
systemctl enable --now ntp

Or as Ubuntu and Red Hat are dismissing ntpd as legacy for some reason, chrony is an option

systemctl enable --now chrony

Read the timedatectl man page, (this version of) set-ntp only controls systemd-timesyncd. Being a SNTP client, it won't discipline the system clock like a proper NTP. I consider this command a little misleading, and manage the time sync service units directly.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。