meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
linux:ntp [2019/10/28 17:57] – niziak | linux:ntp [2019/10/28 22:10] – [Not synchronized clock] niziak | ||
---|---|---|---|
Line 2: | Line 2: | ||
====== Issues ====== | ====== Issues ====== | ||
- | ===== ntp_gettime() returns code 5 (ERROR) | + | ===== Not synchronized clock ===== |
- | <code bash> | + | Cannot set correct time. Manual setting time by '' |
- | Reason: | + | <code bash> |
- | https:// | + | $ sudo timedatectl |
+ | Local time: Mon 2019-10-28 18:11:50 CET | ||
+ | Universal time: Mon 2019-10-28 17:11:50 UTC | ||
+ | RTC time: Mon 2019-10-28 15:58:24 | ||
+ | Time zone: Europe/Warsaw (CET, +0100) | ||
+ | System clock synchronized: | ||
+ | NTP service: inactive | ||
+ | RTC in local TZ: no | ||
+ | </ | ||
- | TIME_ERROR | + | <code bash> |
- | The system clock is not synchronized to a reliable server. This value is returned when any of the following holds true: | + | $ sudo ntptime |
- | | + | ntp_gettime() returns code 5 (ERROR) |
- | | + | time e161a024.e5878318 |
- | | + | |
- | | + | ntp_adjtime() returns code 5 (ERROR) |
- | | + | modes 0x0 (), |
+ | offset 0.000 us, frequency 93.212 ppm, interval 1 s, | ||
+ | | ||
+ | status 0x2041 (PLL, | ||
+ | time constant 3, precision 0.001 us, tolerance 500 ppm, | ||
+ | </ | ||
+ | |||
+ | Reason | ||
+ | Also some AMD platform | ||
+ | You can only set times in the future, setting past times with date command will do nothing | ||
+ | |||
+ | Solution: | ||
+ | |||
+ | stop all ntp daemons, delete ''/ | ||
+ | |||
+ | <code bash> | ||
+ | # set initial adjtimex params | ||
+ | $sudo adjtimexconfig | ||
+ | Comparing clocks (this will take 70 sec)...done. | ||
+ | Adjusting system time by -9.67758 sec/day to agree with CMOS clock...done. | ||
+ | |||
+ | # print current ticks | ||
+ | sudo adjtimex -p | ||
+ | |||
+ | mode: 0 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | time_constant: | ||
+ | precision: 1 | ||
+ | tolerance: 32768000 | ||
+ | tick: 9998 | ||
+ | raw time: 1572283011s 863855330ns = 1572283011.863855330 | ||
+ | |||
+ | # Slow down clock, to do not wait few days for correction | ||
+ | adjtimex -tick 9000 | ||
+ | |||
+ | # Watch how it works | ||
+ | adjtimex -compare | ||
+ | </ | ||
+ | |||
+ | When clock reach good value. Start ntpd. Wait some time and observe ' | ||
+ | Finally it is good to store correct time to RTC '' | ||
- | You can only set times in the future, setting past times with date command will do nothing and no error will be shown. Ntpd service will correct slowly the time at small steps. It's not like in Windows where you can set any time and see the result immediately. | ||