2

If ntpd works, then the kernel copies system time to hardware clock every 11 minutes. It is shown by command

adjtimex --print  

I want to stop the kernel eleven mode. If I run

hwclock --hctosys

the eleven mode stops. But some time later it restores. I think, it is due to ntpd.

How can I stop the eleven mode forever?

1

I'm assuming you're referring to the 11-minute clock updates in Linux. If you want to keep ntpd running without updating the hardware clock, it appears the only viable option is to rebuild your kernel without the RTC_SYSTOHC option:

Set the RTC time based on NTP synchronization

If you say yes here, the system time (wall clock) will be stored in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11 minutes if userspace reports synchronized NTP status.

This requires a rebuild, the option can't be changed using boot flags.

Alternatively, according to the Chrony comparison information, openntpd doesn't activate the kernel synchronisation.

  • Stephen Kitt, thanks for kernel details. Yes, I mean 11-minute clock updates in Linux. Do you think, that ntpd replaced by chrony, may solve my question without kernel rebuilding? – isabpchereda May 24 '16 at 11:46
  • @isabpchereda Chrony uses the same kernel interfaces, so it probably activates the 11-minute updates too. – Stephen Kitt May 24 '16 at 12:39
  • More infomation with regard to "RTC kernel sync" in chrony, ntp and openntpd is at chrony.tuxfamily.org/comparison.html. – isabpchereda May 24 '16 at 13:34
  • @isabpchereda which indicates that openntpd may be a solution (but I haven't tested it). – Stephen Kitt May 24 '16 at 13:43
  • There is implementation of 11 minute mode in linux kernel: lxr.free-electrons.com/source/kernel/time/ntp.c?v=4.4#L509 sync_cmos_clock function – osgx Jan 26 '17 at 15:38
0

In my case, I was able to get the CMOS clock to be in localtime, without a kernel compile, by doing the following:

Make sure /etc/adjtime has 'LOCAL' and not 'UTC' (in my case, it was the last line of the file).

Make sure /etc/hardwareclock has 'localtime' in it (in my case, this was a new file and only had that line in it).

Doing the above seems to have turned off the 'NTP synch' flag in the kernel, which keeps the kernel from writing the UTC time into the CMOS clock upon shutdown. So it is highly likely that the kernel won't save the system time in the CMOS clock (I've not verified this). However, the above 2 changes appear to have turned off '11-minute mode'.

Here's the output of 'timedatectl':

rusty@quigon2 ~ $ timedatectl
Local time: Wed 2019-01-30 14:18:53 MST
Universal time: Wed 2019-01-30 21:18:53 UTC
RTC time: Wed 2019-01-30 14:18:50
Time zone: America/Phoenix (MST, -0700)
Network time on: yes
NTP synchronized: no
RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
...blah blah...

(Note the 'NTP synchronized' info above, but also the RTC in local TZ is yes)

After all of this, you may need to fiddle with NTP or rdate or something to make sure your clock is synchronized somehow. I leave that as an exercise for the reader. (On my machines, I'm running 'rdate -na timemachine ; hwclock --systohc' every 30 minutes (as root). You might be able to run NTPD in this environment and not need the rdate, but I'm not sure about the 'hwclock --systohc' - that might be needed... Again, left as an exercise for the reader.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.