[Solved] NTP not working

I can’t seem to get NTP to work, i get a lot of “connection refused” messages whenever I try any command in ntpq, and when I run ntptime I see:


root@routeserve:~# ntptime
ntp_gettime() returns code 5 (ERROR)
  time e683cfa7.6199c000  Thu, Jul 21 2022 23:14:15.381, (.381252),
  maximum error 16000000 us, estimated error 16000000 us
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 2514.000 us, frequency -11.223 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16000000 us,
  status 0x41 (PLL,UNSYNC),
  time constant 6, precision 1.000 us, tolerance 500 ppm,

The output of uci show system reads:


system.ntp=timeserver
system.ntp.server='0.au.pool.ntp.org' '1.au.pool.ntp.org' '2.au.pool.ntp.org' '3.au.pool.ntp.org'

… there is no


system.ntp.enabled='1'

And I’m not sure how to add it to the config.

uci set system.ntp.enabled=‘1’
uci commit system

NTP works, you just can't check the busybox ntpd status with these query tools.

https://busybox34.rssing.com/chan-75432487/article3.html

If you want more control and information, install the ISC ntpd package.

opkg update
opkg install ntpd
/etc/init.d/sysntpd stop
/etc/init.d/sysntpd disable
/etc/init.d/ntpd start
/etc/init.d/ntpd enable

ntpq will start working instantly and ntptime will clear the errors after about 5 minutes.

3 Likes

Thanks! @pavelgl I will try this when i get back.

Thanks @pavelgl but I'm still getting errors

root@routeserve:~# opkg install ntpd
Package ntpd (4.2.8p15-3) installed in root is up to date.
root@routeserve:~# /etc/init.d/sysntpd stop
Command failed: Not found
root@routeserve:~# /etc/init.d/sysntpd disable
root@routeserve:~# /etc/init.d/ntpd start
system.ntp.server[0]=0.au.pool.ntp.org validates as list(host) with true
system.ntp.server[1]=1.au.pool.ntp.org validates as list(host) with true
system.ntp.server[2]=2.au.pool.ntp.org validates as list(host) with true
system.ntp.server[3]=3.au.pool.ntp.org validates as list(host) with true
system.ntp.enabled=‘1’ validates as bool with false
system.ntp.enable_server is unset and defaults to bool 0
system.ntp.interface is unset and defaults to list(string) (null)
validation failed
root@routeserve:~# /etc/init.d/ntpd enable
root@routeserve:~# ntpq
ntpq> peer
ntpq: read: Connection refused
ntpq>

Not sure what these mean


root@routeserve:~# ntptime
ntp_gettime() returns code 5 (ERROR)
  time e6842d8f.f54e8000  Fri, Jul 22 2022  5:54:55.958, (.958229),
  maximum error 16000000 us, estimated error 16000000 us
ntp_adjtime() returns code 5 (ERROR)
  modes 0x0 (),
  offset 0.000 us, frequency 0.000 ppm, interval 1 s,
  maximum error 16000000 us, estimated error 16000000 us,
  status 0x40 (UNSYNC),
  time constant 2, precision 1.000 us, tolerance 500 ppm,
root@routeserve:~#

There is a problem with the single quotes.

uci delete system.ntp.enabled
uci commit system
/etc/init.d/ntpd restart
1 Like

Thank you so much! ntpq is now working :grin:

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.