Changes between Version 4 and Version 5 of ntp
- Timestamp:
- 06/16/2017 07:36:10 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified ntp
v4 v5 45 45 }}} 46 46 47 == Fixes if synchronisation fails ==47 == Fixes if synchronisation fails following frequent suspend to RAM == 48 48 49 For a long time the default kernel clocksource has been tsc, but it used to be acpi_pm. On one of my machines, in one kernel release, I lost synchronisation and the log showed: 49 On one of my machines, ntp had lost synchronisation. I initially blamed the tsc clocksource in a particular kernel version, and recommended changing it back to acpi_pm. 50 51 === From the initial version of this section: === 52 53 On one of my machines, in one kernel release, I lost synchronisation and the log showed: 50 54 {{{ 51 55 frequency error 1726 PPM exceeds tolerance 500 PPM … … 66 70 to the bootargs in grub. 67 71 72 === A better fix (sysvinit) === 73 74 I forgot about the problem, until one day when I discovered that my desktop clock was 5 minutes slow. In the end, this appears to be related to frequent suspend to RAM, sometimes for a few days. In early versions of pm-utils (which is what I use for s2ram) there was a script to fix up ntpd - but that was removed long ago, in the belief that the clock would only drift for a maximum of 64 seconds realtime (not drift *by* 64 seconds!) and then ntpd would start to sync it. For systemd the preferred methods are apparently different. Anyway,I've now added the following script as /usr/lib/pm-utils/sleep.d/48ntpd (mode 755) and things seem to work - using 'ntpq -p' I can sometimes see offsets of several hundred milliseconds (and increasing!) even when the box has sync'd to my local server, but it seems to stay accurate to within a second, and eventually syncs to a few milliseconds. 75 76 77 {{{ 78 #!/bin/sh 79 # stop ntpd on suspend, fix and start fresh on wakeup 80 81 . "${PM_FUNCTIONS}" 82 83 case $1 in 84 suspend) 85 /etc/rc.d/init.d/ntpd stop 86 ;; 87 resume) 88 /usr/sbin/ntpd -gq 89 /etc/rc.d/init.d/ntpd start 90 *) exit 0 ;; 91 esac 92 exit 0 93 }}} 94 95 68 96 == When the clock is too far away from the correct time == 69 97 70 If ntpd bails out because the clock is too far from the correct time, try stopping ntpd, using98 If ntpd bails out because the clock is too far from the correct time, try stopping ntpd, then use 71 99 {{{ 72 100 ntpd -gq 73 101 }}} 74 to let it sync, and then restart ingntpd. According to the man page, -g can be used multiple times if the clock is far adrift.102 to let it sync, and then restart ntpd. According to the man page, -g can be used multiple times if the clock is far adrift. 75 103 76 104