首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >systemd-timesyncd服务处于空闲状态,不同步时间。

systemd-timesyncd服务处于空闲状态,不同步时间。
EN

Ask Ubuntu用户
提问于 2019-01-16 14:10:29
回答 1查看 5.7K关注 0票数 2

我正在尝试将运行Ubuntu16.04.3LTS的Intel NUC上的时间与运行在Windows PC上的NTP服务器同步。

我已经检查了NTP服务器是否正确运行。

在我看来,服务似乎没有从配置文件/etc/systemd/timesyncd.conf中读取

timedatectl status输出

代码语言:javascript
运行
复制
      Local time: Wed 2019-01-16 21:32:01 CET
  Universal time: Wed 2019-01-16 20:32:01 UTC
        RTC time: Wed 2019-01-16 20:32:01
       Time zone: Europe/Vienna (CET, +0100)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

systemctl status systemd-timesyncdsystemctl restart systemd-timesyncd之后的输出

代码语言:javascript
运行
复制
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor pr
  Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Wed 2019-01-16 21:36:08 CET; 11s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 2316 (systemd-timesyn)
   Status: "Idle."
   CGroup: /system.slice/systemd-timesyncd.service
           └─2316 /lib/systemd/systemd-timesyncd

Jan 16 21:36:08 coretv systemd[1]: Starting Network Time Synchronization...
Jan 16 21:36:08 coretv systemd[1]: Started Network Time Synchronization.

我在/etc/systemd/timesyncd.conf中的配置文件

代码语言:javascript
运行
复制
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=192.168.20.1
#FallbackNTP=ntp.ubuntu.com

如果它有任何改变,所有命令都会以root用户身份在ssh连接上运行。

我遗漏了什么吗?

编辑:

我没有时间再玩这个问题了。我将在我的终端上使用一个解决方案,这样我就不必依赖系统时间。

答案仍然值得赞赏,因为修复这将是一个更清洁的解决方案。

EN

回答 1

Ask Ubuntu用户

发布于 2020-05-22 16:59:57

我意识到这是一个老问题,但最近我遇到了同样的问题,我想分享我的解决方案,以便其他人可以避免花费数小时来解决这个问题。

对我来说,问题在于timesyncd.conf中的timesyncd.conf参数。默认为5秒;但是,当查看Wireshark中的NTP数据包时,根分散值约为10秒。我认为systemd-timesyncd忽略了所有的NTP数据包,因为根色散值高于最大值。

为了解决这个问题,我修改了timesyncd.conf,取消了对以RootDistanceMaxSec开头的行的注释,并将值更新为比我在NTP数据包中看到的根色散值大几秒的数字。然后我重新启动了我的系统,一切都很完美。

希望这能帮到外面的人节省几个小时。

票数 6
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1110282

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档