EDIT 20200301, Does ntp take a long time to sync?
I have a Rev2 arduino Yun I cannot get it to synchronize its clock when booting. I had it configured with SD card and a lot of software and realized this Time function isn’t working (again). Did a complete reset and start over. Yes I can synchronize with Browser using the Luci button “Sync with Browser”, but why not have that command embedded in a startup script like rc.local? ( I tried-see code below)
I have installed nearly every utility having to do with maintaining time as a client, but if one can’t get the OS (OpenWrt LEDE 17) on the right time the sketches will never have the right data points. I know I’ve heard ‘use a I2C clock chip’, bla, bla. but that does not help the browser or any utilities on the Linux side. I went through a lot of exercises to get my Rev0’s to sync in 2015, (not on my bench now), but this Rev2 has me baffled. I had thought maybe it was a wifi issue so all of this Time troubleshooting I am doing through the eth1 port, WIFI has a wrong password so it cannot connect. Looking in the system log, I can see that the wlan tries every two minutes to acquire but remains not connected. Then about an 45 minutes later after boot I see the time jumps to sync’ed state.
Below is a capture from the last terminal (Putty) window before Time synchronized again. I have internet access, can opkg update, install ntp client , SCP, SFTP, load sketches, etc.
Sat Feb 29 20:23:41 PST 2020 root@GYun:~# ping 188.8.131.52 PING 184.108.40.206 (220.127.116.11): 56 data bytes 64 bytes from 18.104.22.168: seq=0 ttl=54 time=7.205 ms 64 bytes from 22.214.171.124: seq=1 ttl=54 time=7.257 ms 64 bytes from 126.96.36.199: seq=2 ttl=54 time=7.167 ms 64 bytes from 188.8.131.52: seq=3 ttl=54 time=7.209 ms 64 bytes from 184.108.40.206: seq=4 ttl=54 time=7.113 ms ^C --- 220.127.116.11 ping statistics --- 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 7.113/7.190/7.257 ms root@GYun:~# date Sat Feb 29 20:24:19 PST 2020 root@GYun:~# date Sat Feb 29 20:32:47 PST 2020 root@GYun:~# uci set system.ntp.enable=1 root@GYun:~# uci commit system root@GYun:~# date Sat Feb 29 20:37:08 PST 2020 root@GYun:~# /etc/init.d/sysntpd restart root@GYun:~# date Sat Feb 29 20:37:29 PST 2020 root@GYun:~# /code] Here it is still off by 10 minutes from Windows clock I have tried a dozen ntp servers. no diff. Time is off by 5 to ten minutes depending on last power down interval. Occasionally I leave a sketch running, 30 minutes, I dunno, come back to the screen and ooops it sync'ed within a second of Windows. The rc.local script for the Yun (Its named GYun, my 7th.) rc.local [code]# Put your custom commands here that should be executed once # the system init finished. By default this file does nothing. boot-complete-notify # added 20200224 ntpd -q -p 0.openwrt.pool.ntp.org /etc/init.d/sysntpd restart exit 0
TIME still not sync’ed. I’m not looking for exact - within a minute would be great.
The real issue here is in case of any power interruption somewhere unattended a remote YUN used as a monitor might never have the clock right. I have read several requests for solutions that seem unanswered by the developers as concrete remedies. Help?
To be clear is there a script that can be executed at boot that replaces the function of the click button “Sync with browser”???