Ubuntu 12.10 时钟错误

Ubuntu 12.10 时钟错误

我遇到了 Ubuntu Quantal 的问题,因为它显示的时间错误。它完全乱了套,time.is now 的正确时间是 09.43,而我的时钟显示 17.48。我正在使用 ntp 服务,我已经检查了时区,它是正确的。我还通过
sudo hwclock --show
sudo dpkg-reconfigure tzdata 检查了硬件时钟,这也是正确的。我也试过了,
sudo dpkg-reconfigure tzdata
但运气不好。我还能尝试什么?

按照要求,这里是我的 /etc/ntp.conf

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift


# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
server time.nist.gov

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient


此外,今天我打开笔记本电脑时,ntp 服务没有运行。

答案1

NTP 不会调整与其理解的时间相差甚远的时钟(默认情况下大于 1000 秒)。

可以通过发出以下命令来覆盖:

sudo ntpd -g 

但理想情况下,您应该在 ntp 守护进程首次启动时执行此操作。为此,请将以下行添加(或修改)到/etc/default/ntp

NTPD_OPTS='-g'

这将确保在启动时时间正确同步,无论时间相差多远,然后 ntp 将持续保持其准确性。

通常,ntp 在启动时启动,但如果您发现ps auwx | grep ntp它没有启动,那么您可以将其添加为启动守护进程:

sudo update-rc.d ntp defaults

相关内容