出于某种我不知道的奇怪原因,我的RPi似乎被错误地设置为UTC+65s。我收到的输出如下:

sudo ntpd -gq
ntpd: time set -65.706156s

我已尝试停止并重新启动ntp服务器(无效)。
当我使用以下命令检查同步服务器时,我确实收到了一个ping,因此这不是服务器没有响应的情况,也不是防火墙问题:
grep -P "^server" /etc/ntp.conf
server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

ping -c 1 0.debian.pool.ntp.org
PING 0.debian.pool.ntp.org (193.1.219.116) 56(84) bytes of data.
64 bytes from tbag.heanet.ie (193.1.219.116): icmp_req=1 ttl=51 time=18.8 ms

--- 0.debian.pool.ntp.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.818/18.818/18.818/0.000 ms

我不知道该如何改正。
更新:
运行ntpq -p命令将生成以下信息:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*adsl-172-10-0-1 117.70.*.110   4 u    2   64    7    0.617   -0.070   0.109

这是我试图同步到的ntp服务器吗-因为那个IP属于中国网(我不知道怎么或者为什么)。
在停止ntp服务、正确设置时间并重新启动服务之后,我还尝试手动设置RPi时间。
我注意到时间被正确地设置了5秒,然后又回到65秒的偏移量。所以看来这就是问题所在。

最佳答案

找到了链接后6中描述的解决方案:
http://forum.openmediavault.org/index.php/Thread/13035-Raspberry-Pi-NTP-service-not-using-etc-ntp-conf/
基本上,将RPi连接到网络时,DHCP服务器充当NTP服务器,并在/var/lib/ntp/ntp.conf.dhcp位置创建NTP.conf文件的副本
此文件覆盖默认的/etc/ntp.conf文件,因此删除它,然后停止ntp服务,执行重新同步,然后启动服务是解决此问题的唯一方法。
重新同步的命令是:

sudo ntpdate -b pool.ntp.org

最初的问题是ntp服务器正在与CHINANET服务器同步,并导致65s偏移,我怀疑这是由于我们网络上的DCHP/ntp服务器配置错误造成的。

关于linux - Debian Linux Raspbian- Raspberry Pi时间偏移比UTC提前65秒,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41848227/

10-16 10:21