When will sysntpd sync time?

when will sysntpd sync time?
when with CPE, sometime it does not get the new date.

killall tcpdump; \
tcpdump -eni any udp port 123 & \
/etc/init.d/sysntpd restart
service_triggers()
{
        procd_add_reload_trigger "system"
        procd_add_validation validate_ntp_section
}

is there another way?
what does it mean that procd_add_reload_trigger "system"

2 Likes

It should do so automatically, but since ntpd was put in a ujail (commit 2d34355e16b442fcf51e93786401716dae3c4ea2), it will not work on first boot due to a race condition if you are using an external DNS resolver for the host in question (i.e., no 127.0.0.1 in /etc/resolv.conf).

... with the main bug dealing with /etc/resolv.conf race conditions being ...

Workaround

Start ntpd directly, without jail

How

# mv /etc/capabilities/ntpd.json /etc/capabilities/ntpd.json-disabled
# service sysntpd restart

Root cause

procd and jail on routers without dnsmasq

#10843 - Time is not synced on (re)boot automatically after a sysupgrade to 22.03.0
#10389 - ujail: changes to resolv.conf may not be reflected in jail

In the detail

Time synchronization among active network devices is essential and critical.
Example: network with multiple Dumb APs

# echo "Diagnostics commands"
# tcpdump -v -n port 123
# grep resolv /proc/`ps | grep '/usr/sbin/ntpd' | grep -v grep | awk '{ print $1 }'`/mountinfo

Unsuccessful workarounds

/etc/init.d/sysntpd		# USE_PROCD variable is not evaluated

Package ntpd is too big to fit into memory (openssl on 8MiB AP with wolfssl)

Package ntpclient

  • does not regularly check ntp server
  • uses NTPv3 (sysntpd NTPv4)

2023-01-05T23:00:00Z

1 Like