Linux 时钟同步有两个 Service 可以选择 ntp.service 或者 systemd-timesyncd.service
使用 apt 安装 apt install systemd-timesyncd
systemd-timesyncd 时钟同步的服务与 ntp 服务的区别是 如果使用的是 systemd-timesyncd,这个服务相比于 ntp 的好处在于
如果使用的是ntp服务,则如果使用 date -s 手动修改了时钟,会导致 ntp 服务退出不会重启
如果使用的是 systemd-timesyncd 服务,则如果使用 date -s 手动修改了时钟,则会立马被恢复过来
root@demo: systemctl show systemd-timesyncd -p Restart
Restart=always
所以以后时钟同步优先使用 systemd-timesyncd.service 服务,而不是使用 ntp.service
防止手动修改了时钟但是没同步过来
但是需要注意 ntp 和 systemd-timesyncd 这两个服务是不能同时存在的
unfortunately by "installing NTP" you did effectively remove
systemd-timesyncd. I can understand that it can fly by too fast on an install/upgrade to notice - but those are mutually exclusive. This is due to the fact that there can only be one NTP service reasonable working on a system.