我的 OpenBSD 主机正在运行 NTPD,但慢了 26 秒,尽管它说“时钟已同步”:
user@host:~# ntpctl -sa
4/4 peers valid, clock synced, stratum 3
peer
wt tl st next poll offset delay jitter
216.239.35.0 time1.google.com
1 10 2 1063s 1078s -1.951ms 101.103ms 0.594ms
216.239.35.4 time2.google.com
* 1 10 2 481s 1067s -1.742ms 112.251ms 0.447ms
216.239.35.8 time3.google.com
1 10 2 729s 991s -1.472ms 11.454ms 0.169ms
216.239.35.12 time4.google.com
1 10 2 830s 1051s -2.203ms 268.285ms 8.564ms
/etc/ntpd.conf
内容:
server time1.google.com
server time2.google.com
server time3.google.com
server time4.google.com
/etc/rc.conf.local
内容:
nsd_flags=
ntpd_flags=-s
unbound_flags=
dhcpd_flags=vmx0
uname -a
输出:
OpenBSD host.domain.xxx 6.0 GENERIC.MP#2319 amd64
我在用着谷歌最近推出了时间服务器。我有几台Linux hostname 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
正确同步的 Debian 机器 ( )。
更改后/etc/ntpd.conf
,/etc/rc.conf.local
我重新启动了 NTPD,甚至重新启动。它仍然落后。
我尝试ntpd -s -d
给出:
user@host:~# ntpd -s -d
ntp engine ready
reply from 216.239.35.8: offset -0.002133 delay 0.011241, next query 9s
set local clock to Thu Dec 1 16:50:01 CET 2016 (offset -0.002133s)
reply from 216.239.35.0: offset -0.001434 delay 0.099329, next query 8s
reply from 216.239.35.4: offset -0.001749 delay 0.109564, next query 8s
reply from 216.239.35.12: offset -0.001908 delay 0.263908, next query 9s
reply from 216.239.35.0: offset -0.000319 delay 0.101452, next query 7s
reply from 216.239.35.4: offset -0.000641 delay 0.111670, next query 9s
reply from 216.239.35.8: offset 0.000052 delay 0.011303, next query 8s
reply from 216.239.35.12: offset -0.000872 delay 0.266129, next query 8s
reply from 216.239.35.0: offset -0.000597 delay 0.101577, next query 5s
reply from 216.239.35.8: offset -0.000018 delay 0.011269, next query 6s
reply from 216.239.35.4: offset -0.000755 delay 0.111866, next query 5s
reply from 216.239.35.12: offset -0.000842 delay 0.265926, next query 6s
peer 216.239.35.0 now valid
reply from 216.239.35.0: offset -0.000587 delay 0.101456, next query 5s
peer 216.239.35.4 now valid
reply from 216.239.35.4: offset -0.005059 delay 0.120511, next query 6s
peer 216.239.35.8 now valid
reply from 216.239.35.8: offset 0.000012 delay 0.011377, next query 9s
peer 216.239.35.12 now valid
reply from 216.239.35.12: offset -0.000859 delay 0.266074, next query 8s
reply from 216.239.35.0: offset -0.000591 delay 0.101480, next query 5s
reply from 216.239.35.4: offset -0.000681 delay 0.111761, next query 8s
reply from 216.239.35.0: offset -0.000675 delay 0.101565, next query 6s
reply from 216.239.35.12: offset -0.000896 delay 0.266249, next query 9s
reply from 216.239.35.8: offset -0.000090 delay 0.011496, next query 6s
reply from 216.239.35.0: offset -0.000676 delay 0.101632, next query 33s
reply from 216.239.35.4: offset -0.000636 delay 0.111738, next query 7s
reply from 216.239.35.8: offset 0.000037 delay 0.011290, next query 9s
reply from 216.239.35.12: offset -0.000871 delay 0.266122, next query 8s
reply from 216.239.35.4: offset -0.000649 delay 0.111825, next query 31s
reply from 216.239.35.8: offset 0.000018 delay 0.011296, next query 32s
reply from 216.239.35.12: offset -0.000922 delay 0.266301, next query 30s
reply from 216.239.35.0: offset -0.000634 delay 0.101520, next query 32s
reply from 216.239.35.4: offset -0.000732 delay 0.111862, next query 30s
reply from 216.239.35.8: offset 0.000041 delay 0.011358, next query 32s
reply from 216.239.35.12: offset -0.000903 delay 0.266024, next query 31s
reply from 216.239.35.0: offset 0.001242 delay 0.101406, next query 34s
reply from 216.239.35.4: offset -0.000638 delay 0.115180, next query 33s
reply from 216.239.35.12: offset 0.000838 delay 0.266193, next query 34s
reply from 216.239.35.8: offset 0.001788 delay 0.011284, next query 34s
clock is now synced
reply from 216.239.35.0: offset -0.000130 delay 0.101597, next query 33s
reply from 216.239.35.4: offset -0.000103 delay 0.111680, next query 34s
reply from 216.239.35.8: offset 0.000554 delay 0.011275, next query 30s
reply from 216.239.35.12: offset -0.000391 delay 0.266116, next query 33s
reply from 216.239.35.0: offset -0.000070 delay 0.101481, next query 32s
reply from 216.239.35.4: offset -0.000163 delay 0.111739, next query 33s
reply from 216.239.35.8: offset 0.000451 delay 0.011480, next query 31s
reply from 216.239.35.12: offset -0.000396 delay 0.266210, next query 30s
^Cntp engine exiting
Terminating
同样,从底部开始有几行显示“时钟现已同步”,但仍然落后约 26 秒。已经过去一天多了,和昨天一样,所以它似乎并没有慢慢修正(或者正在修正)非常慢慢地)。
编辑:正如所指出的瑞·F·里贝罗;我忘了提及该机器是在 ESXi 6 主机上运行的虚拟机(来宾)。然而,上述 Debian 机器/来宾位于同一主机上。我的逻辑是,既然它们看起来工作正常,OpenBSD 应该没有什么不同吧?
我可以做什么/尝试让我的 OpenBSD 正确同步?
编辑: 根据宾克的要求(ntpd 事件来自)/var/log/daemon
内容:
Nov 21 00:06:05 <hostname> ntpd[7477]: adjusting clock frequency by 0.317142 to -14.304083ppm
Nov 22 02:29:01 <hostname> ntpd[7477]: adjusting clock frequency by 0.305442 to -13.998538ppm
Nov 22 15:27:20 <hostname> ntpd[7477]: adjusting clock frequency by -0.138739 to -14.137278ppm
Nov 23 07:42:51 <hostname> ntpd[7477]: adjusting clock frequency by -0.061709 to -14.198986ppm
Nov 23 15:37:42 <hostname> ntpd[7477]: adjusting clock frequency by -0.303711 to -14.502698ppm
Nov 24 01:57:52 <hostname> ntpd[7477]: adjusting clock frequency by 0.266837 to -14.235861ppm
Nov 24 15:28:31 <hostname> ntpd[7477]: adjusting clock frequency by -0.223563 to -14.459424ppm
Nov 25 05:13:04 <hostname> ntpd[7477]: adjusting clock frequency by -0.223494 to -14.682917ppm
Nov 25 18:10:03 <hostname> ntpd[7477]: adjusting clock frequency by -0.324446 to -15.007363ppm
Nov 26 08:20:06 <hostname> ntpd[7477]: adjusting clock frequency by 0.295603 to -14.711760ppm
Nov 26 20:49:23 <hostname> ntpd[7477]: adjusting clock frequency by 0.517934 to -14.193826ppm
Nov 27 07:56:01 <hostname> ntpd[7477]: adjusting clock frequency by -0.269159 to -14.462985ppm
Nov 27 21:58:31 <hostname> ntpd[7477]: adjusting clock frequency by 0.239882 to -14.223103ppm
Nov 28 07:36:25 <hostname> ntpd[7477]: adjusting clock frequency by -0.435059 to -14.658162ppm
Nov 28 16:34:59 <hostname> ntpd[7477]: adjusting clock frequency by -0.299615 to -14.957777ppm
Nov 29 09:26:36 <hostname> ntpd[7477]: adjusting clock frequency by 0.137505 to -14.820272ppm
Nov 30 14:31:15 <hostname> ntpd[7477]: adjusting clock frequency by -0.215574 to -14.991138ppm
Nov 30 18:27:39 <hostname> ntpd[26935]: ntp engine exiting
Nov 30 18:27:39 <hostname> ntpd[3531]: dispatch_imsg in main: pipe closed
Nov 30 18:27:39 <hostname> ntpd[7477]: Terminating
Nov 30 18:27:55 <hostname> ntpd[27795]: ntp engine ready
Nov 30 18:27:58 <hostname> ntpd[27795]: ntp engine exiting
Nov 30 18:27:58 <hostname> ntpd[30737]: dispatch_imsg in main: pipe closed
Nov 30 18:27:58 <hostname> ntpd[15335]: Terminating
Nov 30 18:27:58 <hostname> ntpd[49555]: ntp engine ready
Nov 30 18:28:21 <hostname> ntpd[49555]: peer 216.239.35.0 now valid
Nov 30 18:28:22 <hostname> ntpd[49555]: peer 216.239.35.4 now valid
Nov 30 18:28:23 <hostname> ntpd[49555]: peer 216.239.35.12 now valid
Nov 30 18:28:24 <hostname> ntpd[49555]: peer 216.239.35.8 now valid
Nov 30 18:30:25 <hostname> ntpd[49555]: clock is now synced
Nov 30 18:40:47 <hostname> ntpd[10865]: ntp engine ready
Nov 30 18:40:47 <hostname> ntpd[36747]: set local clock to Wed Nov 30 18:40:47 CET 2016 (offset 0.000113s)
Nov 30 18:41:07 <hostname> ntpd[10865]: peer 216.239.35.8 now valid
Nov 30 18:41:07 <hostname> ntpd[10865]: peer 216.239.35.4 now valid
Nov 30 18:41:08 <hostname> ntpd[10865]: peer 216.239.35.12 now valid
Nov 30 18:41:09 <hostname> ntpd[10865]: peer 216.239.35.0 now valid
Nov 30 18:44:08 <hostname> ntpd[10865]: clock is now synced
Nov 30 18:48:10 <hostname> ntpd[49555]: ntp engine exiting
Nov 30 18:48:10 <hostname> ntpd[44908]: dispatch_imsg in main: pipe closed
Nov 30 18:48:10 <hostname> ntpd[59920]: Terminating
Nov 30 18:48:10 <hostname> ntpd[57325]: ntp engine ready
Nov 30 18:48:11 <hostname> ntpd[4035]: set local clock to Wed Nov 30 18:48:11 CET 2016 (offset 0.000388s)
Nov 30 18:48:29 <hostname> ntpd[57325]: peer 216.239.35.8 now valid
Nov 30 18:48:32 <hostname> ntpd[57325]: peer 216.239.35.4 now valid
Nov 30 18:48:32 <hostname> ntpd[57325]: peer 216.239.35.0 now valid
Nov 30 18:48:33 <hostname> ntpd[57325]: peer 216.239.35.12 now valid
Nov 30 18:50:57 <hostname> ntpd[53395]: Terminating
Nov 30 18:50:57 <hostname> ntpd[57325]: ntp engine exiting
Nov 30 18:50:57 <hostname> ntpd[26288]: dispatch_imsg in main: pipe closed
Nov 30 18:50:57 <hostname> ntpd[50972]: ntp engine ready
Nov 30 18:50:57 <hostname> ntpd[71389]: set local clock to Wed Nov 30 18:50:57 CET 2016 (offset 0.000046s)
Nov 30 18:51:14 <hostname> ntpd[50972]: peer 216.239.35.0 now valid
Nov 30 18:51:19 <hostname> ntpd[50972]: peer 216.239.35.4 now valid
Nov 30 18:51:21 <hostname> ntpd[50972]: peer 216.239.35.12 now valid
Nov 30 18:51:23 <hostname> ntpd[50972]: peer 216.239.35.8 now valid
Nov 30 18:53:46 <hostname> ntpd[46409]: ntp engine ready
Nov 30 18:53:47 <hostname> ntpd[51869]: set local clock to Wed Nov 30 18:53:47 CET 2016 (offset 0.017304s)
Nov 30 18:54:05 <hostname> ntpd[46409]: peer 216.239.35.0 now valid
Nov 30 18:54:06 <hostname> ntpd[46409]: peer 216.239.35.4 now valid
Nov 30 18:54:08 <hostname> ntpd[46409]: peer 216.239.35.8 now valid
Nov 30 18:54:08 <hostname> ntpd[46409]: peer 216.239.35.12 now valid
Nov 30 18:57:13 <hostname> ntpd[46409]: clock is now synced
Nov 30 19:15:19 <hostname> ntpd[43240]: adjusting clock frequency by 0.420934 to -14.570066ppm
Nov 30 19:34:26 <hostname> ntpd[43240]: adjusting clock frequency by 0.080845 to -14.489222ppm
Nov 30 19:53:41 <hostname> ntpd[43240]: adjusting clock frequency by -0.092990 to -14.582212ppm
Dec 1 16:56:15 <hostname> ntpd[43240]: Terminating
Dec 1 16:56:15 <hostname> ntpd[46409]: ntp engine exiting
Dec 1 16:56:15 <hostname> ntpd[59696]: dispatch_imsg in main: pipe closed
Dec 1 16:56:15 <hostname> ntpd[61779]: ntp engine ready
Dec 1 16:56:15 <hostname> ntpd[64211]: set local clock to Thu Dec 1 16:56:15 CET 2016 (offset 0.000150s)
Dec 1 16:56:16 <hostname> ntpd[61779]: ntp engine exiting
Dec 1 16:56:16 <hostname> ntpd[76241]: Terminating
Dec 1 16:56:16 <hostname> ntpd[48763]: dispatch_imsg in main: pipe closed
Dec 1 16:56:16 <hostname> ntpd[19408]: ntp engine ready
Dec 1 16:56:16 <hostname> ntpd[89788]: set local clock to Thu Dec 1 16:56:16 CET 2016 (offset 0.000336s)
Dec 1 16:56:35 <hostname> ntpd[19408]: peer 216.239.35.8 now valid
Dec 1 16:56:36 <hostname> ntpd[19408]: peer 216.239.35.12 now valid
Dec 1 16:56:38 <hostname> ntpd[19408]: peer 216.239.35.4 now valid
Dec 1 16:56:38 <hostname> ntpd[19408]: peer 216.239.35.0 now valid
Dec 1 17:00:49 <hostname> ntpd[19408]: clock is now synced
Dec 1 17:22:51 <hostname> ntpd[68037]: adjusting clock frequency by -0.076636 to -14.641308ppm
开始/停止等是我测试/尝试的东西。
答案1
OpenBSD 和您的虚拟机工作正常;您错误地使用了 Google 时间源。
这是在 OpenBSD 中经常问的问题和手册页。
您正在同步到发布 UTC 时间的时间源。但默认情况下rdate
假设您的时间源发布 TAI-10 时间。 TAI 是所有 SI 秒的严格均匀递增计数,始终为每分钟 60 秒,目前比 UTC 早 36 秒,偶尔会折扣所谓的“闰秒”。 (更准确地说:它打折积极的闰秒;但实际上还没有出现负闰秒。) 2016-12-31 23:59:60 UTC 将会比 UTC 提前 37 秒,闰秒将在本月底到来。
使用 TAI 而不是 UTC 的系统实际上倾向于使用更准确的 TAI-10,即 TAI 计数向未来移动 10,以便与 1970-01-01 00:00:00 UTC 对齐,也称为 TAI-10。作为 1969-12-31 23:59:50 TAI,与 1970-01-01 00:00:00 TAI-10。1 这比 UTC 早 26 秒,很快就会变成 27 秒。
众所周知,谷歌时间源不计算闰秒。他们使用涂抹这将不计其数的额外一秒的价值分散到一整天中,这意味着每年最多有两天谷歌秒不是统一的长度,并且与 SI 秒的长度不同。
rdate
需要-c
选项告诉它您的时间源不计算闰秒,并且您需要使用 Olsen“正确”时区,假设您的内核时钟在 TAI-10 中运行。 (“正确的”时区和计算 TAI 而不是 UTC 的内核时钟有其优点。)
讽刺的是,由于根据您的日志,您也使用中欧时间,因此 OpenBSD 中给出的示例设置经常问的问题是正是适合您的。因此,请阅读 OpenBSD doco 并按照说明进行操作。
或者:如果您想在 UTC 而不是 TAI-10 中运行,请使用“posix”时区。
1 这是一个稍微简化的解释,涉及 UTC 的常用追溯定义,并忽略了这样一个事实:1972 年之前使用的 UT 秒是可变长度的,具有用于与 TAI 相互转换的大型表驱动算法。但这超出了本答案的范围。 1972年之前的情况是可怕的。有些人想废除 UTC 及其闰秒系统和 SI 秒长度,并将其恢复。他们……被误导了。
进一步阅读
- ”为什么我的时钟慢了二十几秒?”.OpenBSD经常问的问题。
rdate
。 OpenBSD 6.0 手册。- 克里斯托弗·帕斯科 (2011-09-15)。 时间、技术和跳秒。谷歌。
- 佩里·洛里尔(2015-07-01)。
time
X.google.com
提供非标准时间。第437章systemd 错误跟踪器。 - 丹尼尔·J·伯恩斯坦。UTC、TAI 和 UNIX 时间。 cr.yp.to。
- 大卫·马多雷 (2010-12-27)。 ”TAI−10 设置”。Unix 闰秒混乱。
- https://unix.stackexchange.com/a/294715/5132
答案2
26 是一个神奇的数字,它是(今天)添加到 UTC 的闰秒数。
您是否将 OpenBSD 时间与 Debian 系统进行比较?“正确的”区域信息文件?
TZ=/usr/share/zoneinfo/right/GB-Eire date; date
Thu Dec 1 19:46:16 GMT 2016
Thu Dec 1 19:46:41 GMT 2016
(抱歉,我只有 25 秒了,因为我还没有更新我的兹数据考虑到去年的飞跃)
其根源在于严格的 POSIX 对时间的解释,您可以在此处阅读更多内容: http://www.ucolick.org/~sla/leapsecs/timescales.html
答案3
虽然我已经有一段时间没有在 VMware 下运行 OpenBSD,但如果您的 VM 主机有正确的时间,您可能需要尝试使用 OpenBSD 的内置 VMware Tools 驱动程序 vmt(4) 作为 ntpd(8) 的传感器,而不是使用时间服务器。如果这不起作用,您还可以尝试通过 sysctl(8) 设置 kern.timecounter.hardware=acpitimer0。
将 ntpd 的输出发布到 /var/log/daemon 中也可能会有所帮助。