![解决方案](https://linux22.com/image/1138284/%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88.png)
更新:请在问题末尾找到一些解决方法!
=========================================================
我无法将日期设置为正确的时间:
root# date
Mi 16. Sep 19:24:42 CEST 2020
root# date --set="2016-07-01 19:41:30"
Fr 1. Jul 19:41:30 CEST 2016
root# date
Mi 16. Sep 19:26:03 CEST 2020
root# sudo dpkg-reconfigure tzdata
Current default time zone: 'Europe/Berlin'
Local time is now: Wed Sep 16 19:27:45 CEST 2020.
Universal Time is now: Wed Sep 16 17:27:45 UTC 2020.
root# hwclock
Fr 01 Jul 2016 19:43:45 CEST -0.281726 Sekunden
root# sudo date --set="2016-07-01 19:46:59.990"
Fr 1. Jul 19:46:59 CEST 2016
root# date
Mi 16. Sep 19:30:31 CEST 2020
我该如何正确设置时间?
我注意到以下情况:
# sudo ntpdate ptbtime1.ptb.de
4 Jul 20:34:24 ntpdate[12575]: step time server 192.53.103.108 offset -132709448.892320 sec
偏移量 -132709448.892320 秒约为 4.2 年。我该如何消除此偏移量?
我可以使用以下方法增加年份:
date --set "1 year"
但我无法通过以下方式减少年份:
date --set "-1 year"
在后一种情况下,命令 date 返回的日期与“-1 年”之前的日期相同。这是一个错误吗?
Kubuntu 14.04 LTS(3.13.0-66-generic)主要用作服务器。
我尝试通过 KDE 设置时间,但结果相同。我无法更改日期/时间。
# ntpdate -d
18 Sep 21:23:23 ntpdate[19635]: ntpdate [email protected] Thu Feb 11 18:28:58 UTC 2016 (1)
18 Sep 21:23:23 ntpdate[19635]: no servers can be used, exiting
# ntpdate-debian -d
18 Sep 21:25:27 ntpdate[19992]: ntpdate [email protected] Thu Feb 11 18:28:58 UTC 2016 (1)
Looking for host 0.ubuntu.pool.ntp.org and service ntp
host found : clint.blazing.de
Looking for host 1.ubuntu.pool.ntp.org and service ntp
host found : static.140.107.46.78.clients.your-server.de
Looking for host 2.ubuntu.pool.ntp.org and service ntp
host found : smash-net.org
Looking for host 3.ubuntu.pool.ntp.org and service ntp
host found : ns2.customer-resolver.net
Looking for host ntp.ubuntu.com and service ntp
host found : golem.canonical.com
transmit(85.220.190.246)
receive(85.220.190.246)
transmit(129.250.35.250)
receive(129.250.35.250)
transmit(78.46.53.8)
receive(78.46.53.8)
transmit(195.50.171.101)
receive(195.50.171.101)
transmit(78.46.107.140)
receive(78.46.107.140)
transmit(148.251.84.200)
receive(148.251.84.200)
transmit(5.189.152.108)
receive(5.189.152.108)
transmit(217.79.181.50)
receive(217.79.181.50)
transmit(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
receive(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
transmit(2a01:238:439c:1900::3:1)
receive(2a01:238:439c:1900::3:1)
transmit(85.220.190.246)
transmit(2a01:4f8:120:710b::123)
receive(85.220.190.246)
receive(2a01:4f8:120:710b::123)
transmit(129.250.35.250)
transmit(2a01:4f8:121:4e4:1:2:3:4)
receive(2a01:4f8:121:4e4:1:2:3:4)
receive(129.250.35.250)
transmit(78.46.53.8)
transmit(148.251.68.100)
receive(78.46.53.8)
receive(148.251.68.100)
transmit(195.50.171.101)
transmit(5.9.122.148)
receive(195.50.171.101)
receive(5.9.122.148)
transmit(78.46.107.140)
transmit(213.95.200.110)
receive(78.46.107.140)
receive(213.95.200.110)
transmit(148.251.84.200)
transmit(144.76.96.7)
receive(148.251.84.200)
receive(144.76.96.7)
transmit(5.189.152.108)
transmit(62.116.130.3)
receive(5.189.152.108)
receive(62.116.130.3)
transmit(217.79.181.50)
transmit(146.0.32.144)
receive(217.79.181.50)
receive(146.0.32.144)
transmit(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
transmit(85.25.195.205)
receive(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
receive(85.25.195.205)
transmit(2a01:238:439c:1900::3:1)
transmit(144.76.172.53)
receive(2a01:238:439c:1900::3:1)
receive(144.76.172.53)
transmit(85.220.190.246)
transmit(2a01:4f8:120:710b::123)
transmit(2001:67c:1560:8003::c7)
receive(85.220.190.246)
receive(2a01:4f8:120:710b::123)
receive(2001:67c:1560:8003::c7)
transmit(129.250.35.250)
transmit(2a01:4f8:121:4e4:1:2:3:4)
transmit(91.189.89.199)
receive(2a01:4f8:121:4e4:1:2:3:4)
receive(91.189.89.199)
receive(129.250.35.250)
transmit(78.46.53.8)
transmit(148.251.68.100)
transmit(91.189.94.4)
receive(78.46.53.8)
receive(148.251.68.100)
receive(91.189.94.4)
transmit(195.50.171.101)
transmit(5.9.122.148)
receive(195.50.171.101)
receive(5.9.122.148)
transmit(78.46.107.140)
transmit(213.95.200.110)
receive(78.46.107.140)
receive(213.95.200.110)
transmit(148.251.84.200)
transmit(144.76.96.7)
receive(148.251.84.200)
receive(144.76.96.7)
transmit(5.189.152.108)
transmit(62.116.130.3)
receive(5.189.152.108)
receive(62.116.130.3)
transmit(217.79.181.50)
transmit(146.0.32.144)
receive(217.79.181.50)
receive(146.0.32.144)
transmit(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
transmit(85.25.195.205)
receive(85.25.195.205)
transmit(2a01:238:439c:1900::3:1)
transmit(144.76.172.53)
receive(2a01:238:439c:1900::3:1)
receive(144.76.172.53)
transmit(85.220.190.246)
transmit(2a01:4f8:120:710b::123)
transmit(2001:67c:1560:8003::c7)
receive(85.220.190.246)
receive(2a01:4f8:120:710b::123)
receive(2001:67c:1560:8003::c7)
transmit(129.250.35.250)
transmit(2a01:4f8:121:4e4:1:2:3:4)
transmit(91.189.89.199)
receive(2a01:4f8:121:4e4:1:2:3:4)
receive(91.189.89.199)
receive(129.250.35.250)
transmit(78.46.53.8)
transmit(148.251.68.100)
transmit(91.189.94.4)
receive(78.46.53.8)
receive(148.251.68.100)
receive(91.189.94.4)
transmit(195.50.171.101)
transmit(5.9.122.148)
receive(195.50.171.101)
receive(5.9.122.148)
transmit(78.46.107.140)
transmit(213.95.200.110)
receive(78.46.107.140)
receive(213.95.200.110)
transmit(148.251.84.200)
transmit(144.76.96.7)
receive(148.251.84.200)
receive(144.76.96.7)
transmit(5.189.152.108)
transmit(62.116.130.3)
receive(5.189.152.108)
receive(62.116.130.3)
transmit(217.79.181.50)
transmit(146.0.32.144)
receive(217.79.181.50)
receive(146.0.32.144)
transmit(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
transmit(85.25.195.205)
receive(2a01:4f8:200:83e9:250:56ff:fe00:4bf9)
receive(85.25.195.205)
transmit(2a01:238:439c:1900::3:1)
transmit(144.76.172.53)
receive(2a01:238:439c:1900::3:1)
receive(144.76.172.53)
transmit(2a01:4f8:120:710b::123)
transmit(2001:67c:1560:8003::c7)
receive(2a01:4f8:120:710b::123)
receive(2001:67c:1560:8003::c7)
transmit(2a01:4f8:121:4e4:1:2:3:4)
transmit(91.189.89.199)
receive(2a01:4f8:121:4e4:1:2:3:4)
receive(91.189.89.199)
transmit(148.251.68.100)
transmit(91.189.94.4)
receive(148.251.68.100)
receive(91.189.94.4)
transmit(5.9.122.148)
receive(5.9.122.148)
transmit(213.95.200.110)
receive(213.95.200.110)
transmit(144.76.96.7)
receive(144.76.96.7)
transmit(62.116.130.3)
receive(62.116.130.3)
transmit(146.0.32.144)
receive(146.0.32.144)
transmit(85.25.195.205)
receive(85.25.195.205)
transmit(144.76.172.53)
receive(144.76.172.53)
transmit(2001:67c:1560:8003::c7)
receive(2001:67c:1560:8003::c7)
transmit(91.189.89.199)
receive(91.189.89.199)
transmit(91.189.94.4)
receive(91.189.94.4)
server 85.220.190.246, port 123
stratum 2, precision -22, leap 00, trust 000
refid [85.220.190.246], delay 0.05002, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268987.31bbe7e5 Tue, Jul 5 2016 21:31:19.194
originate timestamp: db268be4.6732266d Tue, Jul 5 2016 21:41:24.403
transmit timestamp: f039422e.c220cd36 Sat, Sep 18 2027 21:25:34.758
filter delay: 0.05061 0.05026 0.05017 0.05002
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05002, dispersion 0.00000
offset -353547850.367451
server 129.250.35.250, port 123
stratum 2, precision -20, leap 00, trust 000
refid [129.250.35.250], delay 0.06325, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268bc9.9d9a2f66 Tue, Jul 5 2016 21:40:57.615
originate timestamp: db268be4.989e8255 Tue, Jul 5 2016 21:41:24.596
transmit timestamp: f039422e.f554a6e5 Sat, Sep 18 2027 21:25:34.958
filter delay: 0.06454 0.06355 0.06343 0.06325
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.06325, dispersion 0.00000
offset -353547850.380999
server 78.46.53.8, port 123
stratum 2, precision -22, leap 00, trust 000
refid [78.46.53.8], delay 0.05414, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268a69.1c1df7dc Tue, Jul 5 2016 21:35:05.109
originate timestamp: db268be4.cd7fa34f Tue, Jul 5 2016 21:41:24.802
transmit timestamp: f039422f.28872495 Sat, Sep 18 2027 21:25:35.158
filter delay: 0.05522 0.05414 0.05426 0.05435
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05414, dispersion 0.00000
offset -353547850.370135
server 195.50.171.101, port 123
stratum 2, precision -20, leap 00, trust 000
refid [195.50.171.101], delay 0.05035, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2687f6.08c94ea4 Tue, Jul 5 2016 21:24:38.034
originate timestamp: db268be4.fff9a6d0 Tue, Jul 5 2016 21:41:24.999
transmit timestamp: f039422f.5bba8543 Sat, Sep 18 2027 21:25:35.358
filter delay: 0.05165 0.05083 0.05075 0.05035
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05035, dispersion 0.00000
offset -353547850.370799
server 78.46.107.140, port 123
stratum 2, precision -19, leap 00, trust 000
refid [78.46.107.140], delay 0.05481, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268b5f.82006106 Tue, Jul 5 2016 21:39:11.507
originate timestamp: db268be5.344a0d9d Tue, Jul 5 2016 21:41:25.204
transmit timestamp: f039422f.8eedb757 Sat, Sep 18 2027 21:25:35.558
filter delay: 0.05551 0.05540 0.05481 0.05490
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05481, dispersion 0.00000
offset -353547850.368710
server 148.251.84.200, port 123
stratum 3, precision -22, leap 00, trust 000
refid [148.251.84.200], delay 0.05466, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2686f2.a75ff9a8 Tue, Jul 5 2016 21:20:18.653
originate timestamp: db268be5.6755a6bb Tue, Jul 5 2016 21:41:25.403
transmit timestamp: f039422f.c220c86a Sat, Sep 18 2027 21:25:35.758
filter delay: 0.05577 0.05475 0.05466 0.05472
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05466, dispersion 0.00000
offset -353547850.369217
server 5.189.152.108, port 123
stratum 2, precision -23, leap 00, trust 000
refid [5.189.152.108], delay 0.05783, dispersion 0.00000
transmitted 4, in filter 4
reference time: db26868b.3179d6b0 Tue, Jul 5 2016 21:18:35.193
originate timestamp: db268be5.9a937568 Tue, Jul 5 2016 21:41:25.603
transmit timestamp: f039422f.f5568e4a Sat, Sep 18 2027 21:25:35.958
filter delay: 0.05873 0.05795 0.05783 0.05789
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05783, dispersion 0.00000
offset -353547850.370795
server 217.79.181.50, port 123
stratum 2, precision -21, leap 00, trust 000
refid [217.79.181.50], delay 0.05034, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268725.1943524d Tue, Jul 5 2016 21:21:09.098
originate timestamp: db268be5.ccfa76e2 Tue, Jul 5 2016 21:41:25.800
transmit timestamp: f0394230.28876baf Sat, Sep 18 2027 21:25:36.158
filter delay: 0.05121 0.05045 0.05034 0.05035
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05034, dispersion 0.00000
offset -353547850.369936
server 2a01:4f8:200:83e9:250:56ff:fe00:4bf9, port 123
stratum 2, precision -22, leap 00, trust 000
refid [2a01:4f8:200:83e9:250:56ff:fe00:4bf9], delay 0.05411, dispersion 8.00000
transmitted 4, in filter 4
reference time: db268a4c.93bfd335 Tue, Jul 5 2016 21:34:36.577
originate timestamp: db268be6.00f24104 Tue, Jul 5 2016 21:41:26.003
transmit timestamp: f0394230.5bba9092 Sat, Sep 18 2027 21:25:36.358
filter delay: 0.05515 0.05411 0.00000 0.05487
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 0.000000 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05411, dispersion 8.00000
offset -353547850.369215
server 2a01:238:439c:1900::3:1, port 123
stratum 2, precision -20, leap 00, trust 000
refid [2a01:238:439c:1900::3:1], delay 0.04822, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2688e9.e721c6ab Tue, Jul 5 2016 21:28:41.902
originate timestamp: db268be6.340222be Tue, Jul 5 2016 21:41:26.203
transmit timestamp: f0394230.8eedd7fd Sat, Sep 18 2027 21:25:36.558
filter delay: 0.05038 0.04822 0.04825 0.04996
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.04822, dispersion 0.00000
offset -353547850.368229
server 2a01:4f8:120:710b::123, port 123
stratum 2, precision -22, leap 00, trust 000
refid [2a01:4f8:120:710b::123], delay 0.05431, dispersion 0.00000
transmitted 4, in filter 4
reference time: db26844c.372fdd99 Tue, Jul 5 2016 21:09:00.215
originate timestamp: db268be6.671c1721 Tue, Jul 5 2016 21:41:26.402
transmit timestamp: f0394230.c220974f Sat, Sep 18 2027 21:25:36.758
filter delay: 0.05560 0.05505 0.05505 0.05431
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05431, dispersion 0.00000
offset -353547850.369936
server 2a01:4f8:121:4e4:1:2:3:4, port 123
stratum 2, precision -19, leap 00, trust 000
refid [2a01:4f8:121:4e4:1:2:3:4], delay 0.05475, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268b5f.82006106 Tue, Jul 5 2016 21:39:11.507
originate timestamp: db268be6.9a9e00f6 Tue, Jul 5 2016 21:41:26.603
transmit timestamp: f0394230.f5548ee3 Sat, Sep 18 2027 21:25:36.958
filter delay: 0.05707 0.05482 0.05487 0.05475
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05475, dispersion 0.00000
offset -353547850.368975
server 148.251.68.100, port 123
stratum 2, precision -23, leap 00, trust 000
refid [148.251.68.100], delay 0.05426, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2688a3.5d50b802 Tue, Jul 5 2016 21:27:31.364
originate timestamp: db268be6.cd54354b Tue, Jul 5 2016 21:41:26.802
transmit timestamp: f0394231.28879d53 Sat, Sep 18 2027 21:25:37.158
filter delay: 0.05576 0.05472 0.05466 0.05426
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05426, dispersion 0.00000
offset -353547850.370599
server 5.9.122.148, port 123
stratum 2, precision -23, leap 00, trust 000
refid [5.9.122.148], delay 0.05487, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2687f7.382e7714 Tue, Jul 5 2016 21:24:39.219
originate timestamp: db268be7.02dda381 Tue, Jul 5 2016 21:41:27.011
transmit timestamp: f0394231.5bbab928 Sat, Sep 18 2027 21:25:37.358
filter delay: 0.05644 0.05527 0.05487 0.06091
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05487, dispersion 0.00000
offset -353547850.367615
server 213.95.200.110, port 123
stratum 2, precision -24, leap 00, trust 000
refid [213.95.200.110], delay 0.05887, dispersion 0.00000
transmitted 4, in filter 4
reference time: db26889d.b342aa88 Tue, Jul 5 2016 21:27:25.700
originate timestamp: db268be7.3421ecb5 Tue, Jul 5 2016 21:41:27.203
transmit timestamp: f0394231.8eedcabc Sat, Sep 18 2027 21:25:37.558
filter delay: 0.06035 0.05930 0.05901 0.05887
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05887, dispersion 0.00000
offset -353547850.371335
server 144.76.96.7, port 123
stratum 3, precision -22, leap 00, trust 000
refid [144.76.96.7], delay 0.05453, dispersion 0.00000
transmitted 4, in filter 4
reference time: db26896a.82ef2e16 Tue, Jul 5 2016 21:30:50.511
originate timestamp: db268be7.675b0665 Tue, Jul 5 2016 21:41:27.403
transmit timestamp: f0394231.c220b8c3 Sat, Sep 18 2027 21:25:37.758
filter delay: 0.05560 0.05507 0.05473 0.05453
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05453, dispersion 0.00000
offset -353547850.369113
server 62.116.130.3, port 123
stratum 2, precision -23, leap 00, trust 000
refid [62.116.130.3], delay 0.05789, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268bbd.1949605f Tue, Jul 5 2016 21:40:45.098
originate timestamp: db268be7.9aa7655d Tue, Jul 5 2016 21:41:27.604
transmit timestamp: f0394231.f55464d7 Sat, Sep 18 2027 21:25:37.958
filter delay: 0.05927 0.05823 0.05789 0.05804
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05789, dispersion 0.00000
offset -353547850.370114
server 146.0.32.144, port 123
stratum 3, precision -23, leap 00, trust 000
refid [146.0.32.144], delay 0.05066, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2689bc.e2f625ed Tue, Jul 5 2016 21:32:12.886
originate timestamp: db268be7.cf8e0bf6 Tue, Jul 5 2016 21:41:27.810
transmit timestamp: f0394232.28877a6e Sat, Sep 18 2027 21:25:38.158
filter delay: 0.05180 0.05103 0.05066 0.05078
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05066, dispersion 0.00000
offset -353547850.359924
server 85.25.195.205, port 123
stratum 2, precision -22, leap 00, trust 000
refid [85.25.195.205], delay 0.06105, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268678.43f41691 Tue, Jul 5 2016 21:18:16.265
originate timestamp: db268be7.ff7e42eb Tue, Jul 5 2016 21:41:27.998
transmit timestamp: f0394232.5bbaa2a4 Sat, Sep 18 2027 21:25:38.358
filter delay: 0.06247 0.06146 0.06139 0.06105
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.06105, dispersion 0.00000
offset -353547850.378071
server 144.76.172.53, port 123
stratum 3, precision -23, leap 00, trust 000
refid [144.76.172.53], delay 0.05502, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2689a9.4e6b79e3 Tue, Jul 5 2016 21:31:53.306
originate timestamp: db268be8.3456c726 Tue, Jul 5 2016 21:41:28.204
transmit timestamp: f0394232.8eedef7e Sat, Sep 18 2027 21:25:38.558
filter delay: 0.05638 0.05536 0.05502 0.05513
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.05502, dispersion 0.00000
offset -353547850.368483
server 2001:67c:1560:8003::c7, port 123
stratum 2, precision -23, leap 00, trust 000
refid [2001:67c:1560:8003::c7], delay 0.06203, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2688ed.c69880ee Tue, Jul 5 2016 21:28:45.775
originate timestamp: db268be8.6872924c Tue, Jul 5 2016 21:41:28.407
transmit timestamp: f0394232.c220d9b2 Sat, Sep 18 2027 21:25:38.758
filter delay: 0.06351 0.06258 0.06203 0.06207
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.06203, dispersion 0.00000
offset -353547850.368557
server 91.189.89.199, port 123
stratum 2, precision -23, leap 00, trust 000
refid [91.189.89.199], delay 0.06055, dispersion 0.00000
transmitted 4, in filter 4
reference time: db2688ed.c69880ee Tue, Jul 5 2016 21:28:45.775
originate timestamp: db268be8.9b94c35e Tue, Jul 5 2016 21:41:28.607
transmit timestamp: f0394232.f5544947 Sat, Sep 18 2027 21:25:38.958
filter delay: 0.06183 0.06087 0.06055 0.06139
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.06055, dispersion 0.00000
offset -353547850.368600
server 91.189.94.4, port 123
stratum 2, precision -22, leap 00, trust 000
refid [91.189.94.4], delay 0.06114, dispersion 0.00000
transmitted 4, in filter 4
reference time: db268abe.9c37a7d7 Tue, Jul 5 2016 21:36:30.610
originate timestamp: db268be8.cdd60117 Tue, Jul 5 2016 21:41:28.804
transmit timestamp: f0394233.28877a3f Sat, Sep 18 2027 21:25:39.158
filter delay: 0.06210 0.06140 0.06128 0.06114
0.00000 0.00000 0.00000 0.00000
filter offset: -3535478 -3535478 -3535478 -3535478
0.000000 0.000000 0.000000 0.000000
delay 0.06114, dispersion 0.00000
offset -353547850.372071
18 Sep 21:25:39 ntpdate[19992]: step time server 85.220.190.246 offset -353547850.367451 sec
是/etc/default/ntpdate
:
# The settings in this file are used by the program ntpdate-debian, but not
# by the upstream program ntpdate.
# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
# so you only have to keep it in one place.
NTPDATE_USE_NTP_CONF=yes
# List of NTP servers to use (Separate multiple servers with spaces.)
# Not used if NTPDATE_USE_NTP_CONF is yes.
NTPSERVERS="ntp.ubuntu.com"
# Additional options to pass to ntpdate
NTPOPTIONS=""
/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
# 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
#
# 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
漂移文件/var/lib/ntp/ntp.drift
不存在。
ntp是否有一个选项(最后一行/etc/default/ntpdate
),如“无漂移”或“无偏移”?
漂移(或偏移)存储在哪里?我可以手动更新吗?
对于 Ulo 1:
# sudo date 070620292016.30
Mi 6. Jul 20:29:30 CEST 2016
# date
So 19. Sep 20:12:42 CEST 2027
# sudo date --set="2016-07-06 20:30:59.990" && date --rfc-3339=ns
Mi 6. Jul 20:30:59 CEST 2016
2027-09-19 20:13:16.565104422+02:00
# date
So 19. Sep 20:13:20 CEST 2027
# ntpdate -s ntp.ubuntu.com
# date
So 19. Sep 20:13:37 CEST 2027
对于 Ulo 2:
# date
Mo 20. Sep 18:52:15 UTC 2027
# sudo timedatectl set-timezone UTC
# date
Mo 20. Sep 18:52:21 UTC 2027
看起来某项服务错误地“更正”了日期:
# sudo date --set="2016-07-06 20:30:59.700" && date && sleep 1 && date
Mi 6. Jul 20:30:59 CEST 2016
Mi 6. Jul 20:30:59 CEST 2016
So 19. Sep 21:06:31 CEST 2027
这可能是哪种服务?
========================================================
解决方案
在 /etc/ntp.conf 中插入
tinker panic 0
检查 /etc/default/ntpdate 中是否设置了此选项:
NTPDATE_USE_NTP_CONF=yes
检查 /etc/default/ntp 中是否设置了此选项:
NTPD_OPTS='-g'
然后停止 ntp 并将 hwclock 设置为实际日期和时间:
# 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 设置为系统日期/时间(感谢 Michael Hampton):
# hwclock -s
检查 hwclock (Bios 时间) 和 date (系统时间),它们仍然不同:
# hwclock
Sa 09 Jul 2016 18:37:47 CEST -0.984834 Sekunden
# date
Mi 22. Sep 00:24:34 CEST 2027
做不是重新启动 ntp 并等待大约 10 分钟。您可以使用 date 或 hwclock 检查。日期仍然错误!:
# date
Mi 22. Sep 00:29:32 CEST 2027
# date
Mi 22. Sep 00:33:49 CEST 2027
10 分钟后重启。更正文件系统,因为它抱怨最后一次文件系统检查是在将来,如下所示:
sudo fsck -v -a /dev/sda1
更正系统中过期的文件。找到参考文件重新归档带有正确的时间戳:
find / -cnewer /reffile | xargs touch
它会运行一段时间。然后重新启动,一切就应该正常工作了。
答案1
如果你正在将本地时间与时间服务器同步网络时间协议 (NTP),问题可能是您的更改被“重新调整”为时间服务器“认为”正确的时间。
检查 GUI 中的日期和时间设置,对于 KDE 来说,应该系统设置/日期和时间。也许您使用的时间服务器不知为何“关闭”了,选择另一个时间服务器可能会解决您的问题。另外请检查时区设置是否正确。
此外,您还可以使用
ntpdate -d
在命令行上获取一些调试信息。ntpdate
是一个命令行 ntp 客户端。该-d
开关激活调试模式。在该模式下,ntpdate
将从服务器获取信息,但不调整本地时间。此外,它将打印有用的信息以供常规调试。如果ntpdate -d
告诉您没有服务器可以使用,但有应该至少有一个(例如在 GUI 中定义),尝试一下ntpdate-debian -d
。不确定为什么有两个二进制文件,但后者在 Ubuntu 中有效,不确定 Kubuntu 是否有效。
ntp
是一个时间服务器守护进程。在(非特定 NTP)服务器上使用它的想法在Ubuntu 文档:
ntp 守护进程 ntpd 会计算系统时钟的偏移并不断调整它,因此不会出现可能导致日志不一致等情况的较大修正。成本是一点处理能力和内存,但对于现代服务器来说,这是微不足道的。
在您的情况下您应该主要考虑这一点,因为根据的配置ntpdate
,它可能会使用ntp
可用时间服务器列表而不是它自己的列表(参见NTPDATE_USE_NTP_CONF
)/etc/default/ntpdate
。
有了这些信息,如果您的问题与 NTP 相关,您应该能够仔细研究并找出发生了什么。
答案2
有很多方法..例如
sudo date MMDDhhmmyyyy.ss
# sudo date 02021411971.59
或者你可以这样做
sudo date --set="2016-07-02 13:12:59.990" && date --rfc-3339=ns
或者你可以像这样简单地同步
ntpdate -s ntp.ubuntu.com
最后像这样更改时区
sudo dpkg-reconfigure tzdata
来自这里& 欢乐时光设置