How to activate the NTP server?

I try to activate a NTP server on my Turris Omnia, for the machines of the LAN. I have:

config timeserver 'ntp'
  option enabled '1'
  option enable_server '1'

in /etc/config/system but, despite that, nothing listens on port 123 (according to lsof) and clients cannot connect (“connection refused”)

Hello, Please check that you have enabled auto start for ntp server, and if the daemon is running.
Also in clean openwrt I have now on my TP-Link, there is possibility to have two different ntp servers, one is in base system and the 2nd can be installed using opkg and is more advanced. The config you put there indicates you want to use the basic one, so please ensure that you have running and enabled the “sysntpd”, if “sysntpd” is running try to restart it.

I’m afraid it will require more explanations (I’m not an OpenWRT guru). How do you “enable autostart” ? And where do I check “sysntpd” config?

/etc/init.d/sysntpd enable
/etc/init.d/sysntpd start

Changed nothing.

The screenshot I provide you is linked in Foris probably as advance configuration, I think as I still wait for my precious :slight_smile: .

However we can check all necessary from ssh.
First I recommend you to use command
/etc/init.d/sysntpd reload
/etc/init.d/sysntpd restart
to get your edited config properly working.
For check if sysntpd is running we can use
netstat -apntu | grep 123
if you get nothing there sysntpd is not probably running and something is wrong :wink:
This you can also check in top/htop
top | grep ntp
In that case I would ask you to provide me the full config you are using right now.
If all is ok, we can check that the sysntpd is enabled after system start.
/etc/init.d/sysntpd enabled && echo /etc/init.d/sysntpd on || echo /etc/init.d/sysntpd off

OK, no way to make the default NTP server (sysntpd) work on the Omnia. What I did was:

  1. Uninstall ntpclient (otherwise, it takes the port 123)
  2. Install ntpd
  3. Configure it via /etc/config/system for the time servers

It now works. But the Turris Omnia is really not for beginners.

Actually I think you get working the sysntpd now. The ntpclient is package only for getting the time, not to provide, but it could block the busybox-ntpd client/server. NTPD package is using different config file, so if you have now all working - time is sync correctly, you probably use the sysntpd. This you can check in htop

I did one more test and seems to that sysntpd (busybox-ntpd) is just not working when any of ntpd* package is installed, and even in my case doesn’t care that I have enabled in my init.d script only sysntpd. That’s probably because the ntpd* packages replace the /usr/sbin/ntpd file.
The running and working sysntpd is look like this in htop (see ntpd-hotplug thats mean sysntpd is used)

1 Like

Could anybody pls clarify why there are two ntp “clients” configured on Omnia? There is ntpclient (managed through /etc/config/ntpclient or through Luci -> System -> Time Synchronization) and sysntpd (managed through /etc/config/system or Luci -> System -> System)? Not even mentioning the ntpd package.

It seems that nptclient is configured with openwrt ntp pool servers only while sysntpd also with and ntp server but it looks like the nptclient is running (less specific servers)

When I try to use sysntpd also as a server then the ntpd doesn’t start as the port is already taken. In system log I can see:

2016-11-01T09:06:56+01:00 info procd[]: Instance sysntpd::instance1 s in a crash loop 6 crashes, 0 seconds since last crash

and netstat shows:

udp        0      0      ESTABLISHED 1878/ntpclient

I’m trying to understand the configuration before disabling ntpclient. There was similar question for original Turris but left without answer.

Thanks for clarification.

1 Like

The solution could be to set Luci> System > Time Synchronization > Count of time measurements = 1 instead of the default empty, which means infinite. With 1 the ntpclient will run just 10 minutes from the system start and then exits.

BTW. the field Clock Adjustment > Offset frequency on the same page had illegal default value 0. I just removed it.

I tried what you suggested but since ntpclient is using port 123 it prevents ntpd to start, even if it’s here for 1 count interval. So at boot, I still don’t have ntpd server for my hosts.
I tried to remove package ntpclient but it’s automaticaly reinstalled periodicaly or during updates.
It’s a bit annoying since it’s pretty easy to set up on vanilla OpenWRT.

I can’t find this ntpclient in /etc/init.d, how does it launch at boot ?

no problem with ntpd here, it is running fine; have you checked ps | grep ntp ?

Did you try to reboot? If ntpclient is running it uses the same port as ntpd, so there’s no way ntpd can start at boot.

So I found how to disable ntpclient it’s in /etc/hotplug.d there is a call to run ntpclient on new interface. But I’m sure that this files will be overwritten by updates so I prefere to change /etc/config/ntpclient and modify the port to 124, reduce the interval to 1, change the count to 1. So at boot, for 1s I will have ntpclient on port 124 so it doesn’t interfere with ntpd startup.

Yes, I’ve just rebooted and ntpd is up and running. I didn’t have to wait 10 minutes even.