Greetings,
I have encountered an issue regarding NTP time synchronization while provisioning a new device. I have been able to replicate the issue on 3 separate raspberry pi devices. I have read other posts on this forum, yet none seemed to address my issue.
The setup:
- When provisioning the device, I have set-up the config.json file as the tutorial suggests, with
"ntpServers":"<my ntp server IP>"
value that contains my local NTP server IP. - Upon connecting and booting the device, the device doesn’t get provisioned, with logs stating “Error: certificate is not yet valid”.
- I am able to ssh onto the device.
-
timedatectl
shows that no NTP service is not available:
root@fd779a4:~# timedatectl
Local time: Sun 2020-09-20 14:06:44 UTC
Universal time: Sun 2020-09-20 14:06:44 UTC
RTC time: n/a
Time zone: n/a (UTC, +0000)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
- The system clock is set to the creation of the image.
-
chronyc tracking
shows506 cannot talk to daemon
. - When starting that newly provisioned device and connecting to it, the
systemctl status chronyd
command states that it is “inactive (dead)”.
â—Ź chronyd.service - NTP client/server
Loaded: loaded (/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/chronyd.service.d
└─chronyd.conf
Active: inactive (dead)
Docs: man:chronyd(8)
man:chrony.conf(5)
- The device then remains unsynchronized forever, not fetching the configuration due to certificates being invalid.
- This issue persists even when removing the “ntpServers” value from config.json file, leaving the ntp sources to default while provisioning.
The steps i’ve taken as workarounds:
- Check chronyd logs with journalctl:
root@fd779a4:~# journalctl -u chronyd
-- Logs begin at Sun 2020-09-20 10:51:53 UTC, end at Sun 2020-09-20 14:12:16 UTC. --
-- No entries --
-
Attempt to start chronyd. service:
systemctl start chronyd
command hangs indefinitely, chronyd service never starts. No logs are being output. -
Manually forcing the time update with my server
I have manually forced the system time update with chronyd -q
root@eb468d1:~# chronyd -q 'server <my time-server IP> iburst'
2022-04-06T07:11:52Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC -PRIVDROP -SCFILTER -SIGND +ASYNCDNS -NTS -SECHASH +IPV6 -DEBUG)
2022-04-06T07:11:56Z System clock wrong by 87905.389257 seconds (step)
2022-04-07T07:37:02Z chronyd exiting
This command works and time is stepped correctly (I would assume this also verifies that my NTP server is able to provide time synchronization). Afterwards, the device fetches the correct configuration and starts services as it should. However, upon losing power and reconnecting, the system clock is delayed for the amount of time the device remains powered off.
It is also quite tedious for provisioning, having to ssh onto each device separately and force time stepping in order to get the correct initial configuration.
The BalenaOS version i’m using is balenaOS 2.88.5+rev1
Any insight would be greatly appreciated. Thank you in advance!