我有一台运行32位Ubuntu 9.10(i686 2.6.31-20-generic kernel)的AMD Athlon XP-2500 +主机(Shuttle MN31主板,nForce 2 IGP + MCP-T芯片组)。 不幸的是,它的时钟漂移看起来很糟糕(每分钟都会增加一秒),ntpd无法保持机器的同步。
我如何处理这个,所以我可以得到ntpd的工作?
解决的办法是使用adjtimex软件包让内核知道在每个内核打勾期间真正stream逝了多less时间。 如果这个想法与现实有所不同,则系统时钟将运行得更快或更慢。 我引用了在具有大时钟漂移的硬件上进行NTP工作 :
安装后,软件包通常会运行adjtimexconfig命令。 这将在七十秒左右的时间内将系统时钟与硬件实时时钟进行比较,并确定系统时钟的速度有多快或多慢。 然后运行带有-t选项的adjtimex命令来设置“tick”参数,这是每个内核打勾时钟应该提前的微秒数。 它也会使用这个信息更新/ etc / default / adjtimex文件,以便在重新启动时保留它。
这个问题可能是几个时钟或定时器之一特别不准确或可能有缺陷的振荡器或定时器/时钟(包括RTC)无源元件(石英晶体,以及任何相关的电容器)。 如果这是原因,你可能无法完全解决它,如果准确的时间对你至关重要。
已知nVidia nForce2主板芯片组非常不稳定 。 APIC和ACPI, 变速处理器和前端总线(FSB)扩频(SS)振荡器/时钟问题也有可能影响精度。 一个潜在的软件(内核)问题是某些版本的2.6.x内核错误地检测到了TSC(时间戳计数器)频率 ,一些AMD处理器根据处理器的核心时钟速度来调整TSC(即节能,类似于SpeedStep在英特尔处理器)。
如果还没有,请查看NTP文档以解决NTP问题 。
如果以上都不能减less时钟的不稳定行为,那么可以使用adjtimex和NTP手动校准。 确保在Ubuntu上删除任何现有的NTP漂移文件/var/lib/ntp/ntp.drift ,可能位于/ etc / ntp /其他一些Unix / Linux系统上)或ntp.conf中的条目。
对于可能陈述明显的道歉,但要确保NTPconfiguration文件(通常是/etc/ntp.conf或类似的)中包含3或4个可到达的 NTP服务器。 并请使用(公共)服务器“closures”给你。 大多数ISP或networking提供商提供免费访问自己的内部NTP服务器, 使用它 。 否则使用来自http://pool.ntp.org/的公共服务器,最好位于你所在的省/州或至less国家。
我目前的做法是从root的crontab每分钟运行一次ntpdate。 这使得时间回到每分钟不到一秒的时间。 我对这个解决scheme并不满意。 但是,它确实certificate了漂移的一致性:
ntpdate[20526]: step time server 218.45.21.199 offset -0.932912 sec ntpdate[20549]: step time server 218.45.21.199 offset -0.932647 sec ntpdate[20572]: step time server 218.45.21.199 offset -0.922805 sec ntpdate[20597]: step time server 218.45.21.199 offset -0.949046 sec ntpdate[20621]: step time server 219.117.196.238 offset -0.941480 sec ntpdate[20650]: step time server 219.117.196.238 offset -0.925179 sec ntpdate[20673]: step time server 219.117.196.238 offset -0.930992 sec ntpdate[20698]: step time server 219.117.196.238 offset -0.949393 sec ntpdate[20726]: step time server 219.117.196.238 offset -0.923139 sec ntpdate[20751]: step time server 219.117.196.238 offset -0.933554 sec
你可以编辑configuration文件(通常是/etc/ntp.conf)来设置一些有用的东西,比如minpoll:
minpoll, maxpoll These options specify the minimum and maximum poll intervals for NTP messages, in seconds as a power of two.The maximum poll interval defaults to 10 (1,024 s), but can be increased by the maxpoll option to an upper limit of 17 (36.4 h). The minimum poll interval defaults to 6 (64 s), but can be decreased by the minpoll option to a lower limit of 4 (16 s). These option are valid only with the server and peer commands.
尝试从ntpd的命令行选项中删除“-g”选项。