LinkedIn Sourceforge Twitter

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

NTPD does not sync your clock on OpenBSD

Posted on 2023-12-09 22:48:00 from Vincent in OpenBSD

The clock of your OpenBSD machine is managed by NTPD. But in some cases this is not sufficient


Your clock is not adapted

On OpenBSD machine the NTP daemon is automatically started at boot time. But, if you are in a situation where you clock is not correct, amongst reasons this could be because the offset is too big.

Indeed, even your ntpd is running it could be that the clock is not correct.

You can check the situation via the command ntpctl.

Check situation

Here after we see that there is a big offset of about 1 hour. Too big to be corrected by NTPD.

obsd:~ $ ntpctl -s all
4/5 peers valid, constraint offset -3495s, clock unsynced, clock offset is -3494889.996ms

peer
   wt tl st  next  poll          offset       delay      jitter
162.159.200.123 time.cloudflare.com
    1  2  -  244s  300s             ---- peer not valid ----
162.159.200.123 from pool pool.ntp.org
    1 10  3   27s   31s         8.088ms    28.701ms    41.202ms
45.87.77.15 from pool pool.ntp.org
    1 10  2    3s   34s        15.892ms    43.115ms    49.224ms
162.159.200.1 from pool pool.ntp.org
    1 10  3   13s   33s         7.938ms    29.292ms    31.525ms
109.68.160.220 from pool pool.ntp.org
    1 10  2   15s   32s         9.749ms    28.183ms    30.454ms

Manual correction

The best tool to correct the date and time manually is rdate by doing the following command:

obsd:~ $ doas rdate -ncv pool.ntp.org

After the command your clock should be at the correct timing. You can verify it via the ntpctl command:

obsd:~ $ ntpctl -s all
5/5 peers valid, constraint offset -1s, clock synced, stratum 3

peer
   wt tl st  next  poll          offset       delay      jitter
162.159.200.123 time.cloudflare.com
    1 10  3  258s  525s         0.090ms    13.641ms     2.512ms
45.87.78.35 from pool pool.ntp.org
 *  1 10  2  130s  543s        13.650ms    40.057ms    52.079ms
109.68.160.220 from pool pool.ntp.org
    1 10  2   47s  543s         1.723ms    15.618ms     5.734ms
162.159.200.1 from pool pool.ntp.org
    1 10  3  343s  522s         0.003ms    14.646ms     4.317ms
162.159.200.123 from pool pool.ntp.org
    1 10  3 1581s 1600s         0.900ms    14.961ms     4.536ms

The list of peers could be different in your case. This depends on what you have in your /etc/ntpd.conf file

Conclusion

In case you motherboard battery is dying, a new bios setup, ... you could have clock with a too far offset. In such case ntpd will not be able to correct it.

Do not trust at 100% ntpd ;)

Verify your clock after modifications on your motherboard or in your bios.



4, 4
displayed: 1451



What is the second letter of the word Moon?