Problem with ntpd and time sync

Hi,

I use ntpd and ntpdate, and sysntpd is disable, but in the log I always have ;

ntpd[6948]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized

Also, when I try that

 ntpd -d -n -q -N -I wan  -p 149.56.37.32 -p 162.159.200.1
ntpd error:  only one pidfile option allowed
 25 09:43:37 2024 daemon.notice ntpd[1571]: ntpd exiting on signal 15 (Terminated)
Mon Mar 25 09:43:37 2024 daemon.info ntpd[1571]: 54.39.23.64 local addr 24.xx.xx.x -> <null>
Mon Mar 25 09:43:37 2024 daemon.info ntpd[1571]: 162.159.200.1 local addr 24.xx.xx.xx -> <null>
Mon Mar 25 09:43:37 2024 daemon.info ntpd[1571]: 216.6.2.70 local addr xx.xx.xx.x -> <null>
Mon Mar 25 09:43:37 2024 daemon.info ntpd[1571]: 216.232.132.95 local addr xx.xx.xx.x -> <null>
Mon Mar 25 09:43:37 2024 daemon.notice ntpd[6948]: ntpd 4.2.8p15@1.3728-o Sat Mar 2xx.xx.xx.x UTC 2024 (1): Starting
Mon Mar 25 09:43:37 2024 daemon.notice ntpd[6948]: Command line: /sbin/ntpd -g -u ntp:ntp -p /var/run/ntpd.pid -n -c /var/etc/ntpd.conf

or if I remove one time server;

root@OpenWrt:~#  ntpd -d -n -q -N -I wan  -p 149.56.37.32
25 Mar 11:22:12 ntpd[9796]: ntpd 4.2.8p15@1.3728-o Sat Mar 23 22:47:29 UTC 2024 (1): Starting
25 Mar 11:22:12 ntpd[9796]: Command line: ntpd -d -n -q -N -I wan -p 149.56.37.32
25 Mar 11:22:12 ntpd[9796]: ----------------------------------------------------
25 Mar 11:22:12 ntpd[9796]: ntp-4 is maintained by Network Time Foundation,
25 Mar 11:22:12 ntpd[9796]: Inc. (NTF), a non-profit 501(c)(3) public-benefit
25 Mar 11:22:12 ntpd[9796]: corporation.  Support and training for ntp-4 are
25 Mar 11:22:12 ntpd[9796]: available at https://www.nwtime.org/support
25 Mar 11:22:12 ntpd[9796]: ----------------------------------------------------
25 Mar 11:22:12 ntpd[9796]: sched_setscheduler(): Function not implemented
25 Mar 11:22:12 ntpd[9796]: proto: precision = 2.240 usec (-19)
25 Mar 11:22:12 ntpd[9796]: getconfig: Couldn't open </etc/ntp.conf>: No such file or directory
move_fd: estimated max descriptors: 1024, initial socket boundary: 48
25 Mar 11:22:12 ntpd[9796]: unable to bind to wildcard address :: - another process may be running - EXITING

cat /etc/config/system

config system
	option hostname 'OpenWrt'
	option timezone 'EST5EDT,M3.2.0,M11.1.0'
	option ttylogin '0'
	option log_size '64'
	option urandom_seed '0'
	option compat_version '1.1'
	option zonename 'America/New York'
	option log_proto 'udp'
	option conloglevel '8'
	option cronloglevel '5'

config timeserver 'ntp'
	list server 'time.cloudflare.com'
	list server '0.openwrt.pool.ntp.org'
	list server '1.openwrt.pool.ntp.org'
	list server '2.openwrt.pool.ntp.org'
	list server '3.openwrt.pool.ntp.org'
        option enabled '1'
        option enable_server '1'

cat /etc/config/dhcp

config dnsmasq
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'lan'
	option expandhosts '1'
	option cachesize '1000'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases'
	option localservice '1'
	option ednspacket_max '1232'
	list addnmount '/bin/busybox'
	list server '/pool.ntp.org/1.1.1.1'
        list server '/1.pool.ntp.org/8.8.8.8'
        list server '/2.pool.ntp.org/9.9.9.9'
	list server '/time.cloudflare.com/1.1.1.1'
	list server '127.0.0.1#5353'
	option noresolv '1'
	option allservers '1'

any advice would be great,
thanks

Busybox ntpd is configured differently than full ntpd. The big difference you're seeing is that Busybox uses -p to specify a peer, while full has the peers in a file and -p on the command line has a different meaning.

I'm not sure what UCI support exists for full ntpd. Is there a good reason for not using the default?

I use the package dnsproxy and it seems that we need ntpd, ntpdate

sorry ... could you explain this statement?
how ntpd/ntpdate is different from built in ntp ?
they all grab time from external server with UPD port 123

1 Like

someone told me to use that with dnsproxy, I don't really ask why..

To synchronize the system clock instead of using busybox one.
Did you disable sysntpd? copy system config under files folder
Check this out [OpenWrt Wiki] NTP client / NTP server

System config

[...]
config timeserver 'ntp'
	list server 'time.cloudflare.com'
	list server '0.openwrt.pool.ntp.org'
	list server '1.openwrt.pool.ntp.org'
	list server '2.openwrt.pool.ntp.org'
	list server '3.openwrt.pool.ntp.org'
	option enable_server '1'
[...]

Time have to be somewhat in sync for SSL/HTTPS handshake to work ?

@ninjanoir78 try booting Openwrt with the dnsproxy off, start it after ntp have synced.

as you could see, you are using !!! built in sysntpd
option enabeld '1'

so maybe this is the reason ... you have two process fighting for udp/123 ?

sorry @frollic
i asked what is the difference between sysntpd / ntpd / ntpdate

not why one need to sync time :slight_smile:

1 Like

oh, I remove that and try it again. That option was not there this morning, but I tried many things so it is still there, maybe I just forgot to remove it..

since you following someone advice and poking :slight_smile: in LuCI ... maybe the best solution is to reset to default ?

look, built in sysntpd work without problem (using is everyday) and there is no reason to replace / disable this package

start from scratch

2 Likes

@nihilt

what do you think?

what is your config in etc/config/system ?

ok, here it is

it is CLIENT + local SERVER

config timeserver 'ntp'
        option use_dhcp '0'
        option enable_server '1'
        list server 'time.apple.com'
        list server 'time.nist.gov'

this will produce

/usr/sbin/ntpd -n -N -l -S /usr/sbin/ntpd-hotplug -p time.apple.com -p time.nist.gov

"-l" is local server

config timeserver 'ntp'
        option use_dhcp '0'
        option enable_server '0'
        list server 'fdff:255::30'
        list server 'fd00:2:255::1'

it is CLIENT only, and produce this:

/usr/sbin/ntpd -n -N -S /usr/sbin/ntpd-hotplug -p fdff:255::30 -p fd00:2:255::1

so, there is NO "-l"

2 Likes