我的Ubuntu 10.04服务器有ntpd在默认configuration下运行。
问题是它不同步。 系统日志显示:
kernel time sync status 2040
当我尝试停止ntpd并运行ntpd -q它确实工作。
所以我猜测,不同之处在于ntpdconfiguration为作为服务运行的方式。
这就是ntpd作为服务运行的方式:
/usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104
我试过的其他事情是运行ntpdate,它工作,但事后重新启动ntpd再次无法同步。 还尝试添加更多的服务器,这并没有帮助:
ntpq -p显示:
remote refid st t when poll reach delay offset jitter ============================================================================== europium.canoni 193.79.237.14 2 u 45 64 1 2.047 0.091 0.001 *ns1.bvc-cloud.d 160.45.10.8 2 u 28 64 1 17.228 0.133 0.149 lswb-nl-81.serv 193.79.237.14 2 u 27 64 1 11.976 -2.968 0.053 ns208372.ovh.ne 213.186.33.99 3 u 26 64 1 8.021 -0.859 0.100 melli.adop.de 40.179.132.91 2 u 25 64 1 17.049 1.430 0.163
如何知道为什么ntpd在作为守护程序运行时无法同步,而不是在使用-q运行时进行同步?
更新
在ntp.conf我有以下服务器:
server ntp.ubuntu.com server pool.ntp.org
我也试过添加:
server 0.fedora.pool.ntp.org iburst server 1.fedora.pool.ntp.org iburst server 2.fedora.pool.ntp.org iburst server 3.fedora.pool.ntp.org iburst
原来,重新启动NTP服务实际上并不尝试同步时钟。 那个错误信息对我来说还是不清楚,但是在重新启动服务后15分钟左右,时钟同步正常。
ntpd不会立即将正确的时间冲入OS时钟,因为这可能会导致使用时钟的软件出现错误,所以它会随着时间的推移轻轻地增加更正。 还要注意的是,如果你的系统时钟太远(默认是1000秒),ntpd会把这个消息放到日志中,并且无法启动