I’ve been dealing with a nagging problem for several months. The problem? I can’t get my OpenVZ Host Node, aka. HN, to keep consistent time. I’ve even been running ntpd, and the time would still invariably drift so that the HN and the Virtual Environments, aka. VEs, running on the HN were all several hours behind. Simply restarting ntpd would temporarily fix the situation, but I shouldn’t have to do that.
So I finally hunkered down and figured out how to solve this problem. These 2 threads proved extremely helpful in determining the fix.
These threads offered 2 fixes to try. The first, was to modify the ntp.conf file so that any server definitions now included the burst & iburst switches like this:
1 2 3 4 | # /etc/ntp.conf
...
server 192.168.1.6 burst iburst
... |
Adding these switches seemed to help, but then my /var/log/messages log started getting filled with synch attempts by ntpd like these:
1 2 3 4 5 6 7 8 9 10 11 12 | Jul 10 03:50:18 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 03:51:24 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 Jul 10 03:59:59 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 04:01:21 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 Jul 10 04:11:52 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 04:15:05 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 Jul 10 04:27:56 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 04:30:06 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 Jul 10 04:41:53 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 04:47:17 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 Jul 10 05:03:28 mulder ntpd[15032]: synchronized to LOCAL(0), stratum 10 Jul 10 05:12:05 mulder ntpd[15032]: synchronized to 192.168.1.6, stratum 3 |
The second suggestion was the key tip. It recommended that you add a kernel switch called clock=pmtmr to the grub.conf file. Once I tried this I received a warning message in the dmesg log stating that this switch had been deprecated, and the new switch was now clocksource=acpi_pm.
1 2 3 4 5 | % dmesg | grep -i clock Command line: ro root=/dev/VolGroup00/LogVol00 rhgb quiet clock=pmtmr Kernel command line: ro root=/dev/VolGroup00/LogVol00 rhgb quiet clock=pmtmr Warning: clock=pmtmr is deprecated. Use clocksource=acpi_pm. Real Time Clock Driver v1.12ac |
So I modified the grub.conf to incorporate the clocksource switch, rebooted the system, and was rewarded with a cleaner dmesg.
1 2 3 4 | % dmesg | grep -i clock Command line: ro root=/dev/VolGroup00/LogVol00 rhgb quiet clocksource=acpi_pm Kernel command line: ro root=/dev/VolGroup00/LogVol00 rhgb quiet clocksource=acpi_pm Real Time Clock Driver v1.12ac |
A quick check of /var/log/messages looked good, no more ntpd synch messages:
1 2 3 4 5 6 7 8 9 10 11 | Jul 11 00:30:49 mulder ntpd[24578]: ntpd 4.2.2p1@1.1570-o Thu Apr 9 12:53:31 UTC 2009 (1) Jul 11 00:30:49 mulder ntpd[24579]: precision = 1.000 usec Jul 11 00:30:49 mulder ntpd[24579]: Listening on interface wildcard, 0.0.0.0#123 Disabled Jul 11 00:30:49 mulder ntpd[24579]: Listening on interface wildcard, ::#123 Disabled Jul 11 00:30:49 mulder ntpd[24579]: Listening on interface lo, ::1#123 Enabled Jul 11 00:30:49 mulder ntpd[24579]: Listening on interface veth103.0, fe80::218:51ff:fe43:8487#123 Enabled Jul 11 00:30:49 mulder ntpd[24579]: Listening on interface vmbr0, fe80::222:15ff:fe91:c12d#123 Enabled Jul 11 00:30:55 mulder ntpd[24579]: kernel time sync status 0040 Jul 11 00:30:56 mulder ntpd[24579]: frequency initialized 25.118 PPM from /var/lib/ntp/drift Jul 11 00:42:51 mulder ntpd[24579]: synchronized to LOCAL(0), stratum 10 Jul 11 00:43:54 mulder ntpd[24579]: synchronized to 192.168.1.6, stratum 3 |
Just to be on the safe side, I opted to leave the burst & iburst switches on the server line in the /etc/ntp.conf file. For completeness, I researched what the burst/iburst switches do. Here are those descriptions right out of the ntp.conf man page:
burst – When the server is reachable, send a burst of eight packets instead of the usual one. The packet spacing is normally 2 s; however, the spacing between the first and second packets can be changed with the calldelay command to allow additional time for a modem or ISDN call to complete. This option is valid with only the server command and is a recommended option with this command when the maxpoll option is 11 or greater.
iburst – When the server is unreachable, send a burst of eight packets instead of the usual one. The packet spacing is normally 2 s; however, the spacing between the first and second packets can be changed with the calldelay command to allow additional time for a modem or ISDN call to complete. This option is valid with only the server command and is a recommended option with this command.
After waiting for ~2 hours, I still did not see anymore of the ntp synch messages in /var/log/messages. Since the burst/iburst switches don’t seem to be causing any additional problems I’m going to leave them on going forward, and I may remove them completely at a later date. For now, I’m going to wait and make sure that the time remains stable before I do that.
