Hello,
We followed this guide : Time management - Balena Documentation
To add our custom NTP server in config.json, it works but it seems to be added to a list of pre-defined servers meaning we’re never sure which server will actually be used.
Is there a way to force a specific server ?
thanks !
Hi, at the moment you can add a custom NTP server but not replace the default ones. The assumption is that it does not matter which server is being used as long as it is accessible.
Why is specifying a specific server required for your use case?
We’re using a local NTP server that is connected to various hardware and we need to ensure that every device gets it’s time from the same server in order to be as accurate as possible.
Hi, thanks for the details. So I assume the devices are using an RTC but need the initial time set to be as accurate as possible. What I would recommend is to stop the hostOS chronyd daemon and run one in the application container configured to use just the local server,
When I mean stop the hostOS chronyd, I mean use d-bus to stop it when the application starts (there are some examples of this in BalenaOS Masterclass - Balena Documentation), and then run a new chronyd in the container app.
As a side test I tried running ntpdate in a container on my Mac which didn’t work, after some reading it seems setting the clock inside a container is not allowed, but perhaps that would still work with balena ?
Hi, yes, we have customers who have done this in the past. A privileged container will be able to set the system time.
Thanks, will give it a try !
If the network blocks all NTP traffic except for a local NTP server, will it sequentially try all of the options in the list each time before falling back to the local NTP?
Hi, sorry for the late reply. BalenaOS uses dnsmasq as DNS client and cache and it will query all DNS server simultaneously and use the first reply.