我的服务器在未来2027年:
# sudo ntpdate ptbtime1.ptb.de 9 Jul 00:04:01 ntpdate[10000]: step time server 192.53.103.108 offset -353547847.989546 sec # date Di 21. Sep 23:48:18 CEST 2027 # hwclock Sa 09 Jul 2016 02:03:56 CEST -0.234935 Sekunden
这个漂移很大,超过10年。 我不能用“正常”重置来改变漂移。 我已经阅读了几篇文章,并尝试了很多东西,比如ntpdate -b , ntpd -gq或者修补程序恐慌0 。 我改变时区,我试图手动设置date/时间。 没有工作。 我怎样才能纠正这一点? 请有人帮我吗? 我运行在Kubuntu 14.04 LTS(GNU / Linux 3.13.0-66-generic i686)
================================================== ================
这会导致一个问题吗?
# sudo service ntp stop * Stopping NTP server ntpd [ OK ] # ntpq -p ntpq: read: Connection refused
================================================== ================
# sudo service ntp stop * Stopping NTP server ntpd [ OK ] # sudo ntpd -gq ntpd: time set -353547849.485594s # sudo service ntp start * Starting NTP server ntpd [ OK ] # date Mi 22. Sep 11:39:09 CEST 2027
================================================== ==================
请注意ntpd有多远“太远了”? 它能突然跳到重负荷吗? 这可以被覆盖? “根据手册页ntpd将不会工作,如果你的时钟超过1000秒closures。
================================================== ==================
我试图手动改变它:
# date Mi 22. Sep 11:32:09 CEST 2027 # sudo date --set="2016-07-09 11:50:59.990" Sa 9. Jul 11:50:59 CEST 2016 # date Mi 22. Sep 11:35:08 CEST 2027
================================================== ================
我可以通过date增加漂移 – “-1年” 。 但我不能减less它。
================================================== =======================
它不工作:
# sudo service ntp stop * Stopping NTP server ntpd [ OK ] # sudo ntpdate-debian 9 Jul 14:56:52 ntpdate[3684]: step time server 131.188.3.220 offset -353547850.182477 sec # sudo service ntp start * Starting NTP server ntpd [ OK ] # date Mi 22. Sep 14:41:25 CEST 2027
更新:我没有耐心。 我不得不再等一等,但这个巨大的漂移仍然存在。
================================================== ===
/etc/ntp.conf
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help tinker panic 0 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 ntp.ubuntu.com server pool.ntp.org server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org # 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
================================================== ===
我也尝试过sntp
# sudo sntp -s ntp.ubuntu.com 22 Sep 12:53:56 sntp[17210]: Started sntp 2027-09-22 12:53:56.128427 (-0100) -353533451.192434 +/- 0.049652 secs 2027-09-22 12:53:56.155758 (-0100) -176766725.596156 +/- 0.024307 secs 2027-09-22 12:53:56.183422 (-0100) -265150088.380065 +/- 0.049652 secs # date Mi 22. Sep 12:54:01 CEST 2027
================================================== ===
以下是ntpdate-debian之后的date:
# date Mi 22. Sep 12:54:40 CEST 2027 # sudo ntpdate-debian -s ntp.ubuntu.com && date Sa 9. Jul 17:15:02 CEST 2016 # date Mi 22. Sep 12:59:20 CEST 2027 # sudo ntpdate-debian -s ntp.ubuntu.com && date && date && date Mi 22. Sep 13:00:21 CEST 2027 Mi 22. Sep 13:00:21 CEST 2027 Mi 22. Sep 13:00:21 CEST 2027 # sudo ntpdate-debian -s ntp.ubuntu.com && date && date && date Sa 9. Jul 17:16:44 CEST 2016 Mi 22. Sep 13:00:55 CEST 2027 Mi 22. Sep 13:00:55 CEST 2027
================================================== ===
删除漂移文件:
sudo service ntp stop rm /etc/adjtime rm /var/lib/ntp/ntp.drift shutdown –h now
重新启动后,/var/lib/ntp/ntp.drift为空。 / etc / adjtime是
0.000000 1821611426 0.000000 1821611426 UTC
date/时间是一样的。 漂移在哪里存储?
================================================== ======
Michael Hampton:
我停止ntp(用ps –aux | grep ntp检查)并使用hwclock –s :
# sudo service ntp stop * Stopping NTP server ntpd [ OK ] # sudo hwclock --set --date="7/9/16 18:37:30" # hwclock Sa 09 Jul 2016 18:37:34 CEST -0.047338 Sekunden # hwclock -s # hwclock Sa 09 Jul 2016 18:37:47 CEST -0.984834 Sekunden # hwclock Sa 09 Jul 2016 18:38:01 CEST -0.219219 Sekunden # date Mi 22. Sep 00:24:34 CEST 2027 # date Mi 22. Sep 00:29:32 CEST 2027 # date Mi 22. Sep 00:33:49 CEST 2027
我不得不重新启动,我不得不纠正文件系统,因为它抱怨最后的文件系统检查是在未来。
非常感谢所有帮助过我的人,非常感谢Michael!
由于您运行的是基于Debian的发行版,请尝试以下操作:
sudo service ntp stop sudo ntpdate-debian sudo service ntp start