question

sam-carleton avatar image
sam-carleton asked

NTP Time server on BeagleBone Black

With the amazing shortage of Raspberry Pi's, I finally broke down and purchased a BeagleBone Black to run Venos OS. The time is way off and when I went looking to set up the NTP server, it looks like the ntp client is not installed. When I go look at the different packages (opkg list | grep ntp) it comes up with nothing!

How does one go about configuring and setting up the NTP client to set the time on the BeagleBone?

The results of doing a opkg update:
root@beaglebone:~# opkg update
Downloading https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/all/Packages.gz.
Downloading https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/cortexa8hf-neon/Packages.gz.
Downloading https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/beaglebone/Packages.gz.
Collected errors:
 * opkg_download_backend: Failed to download https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/all/Packages.gz, wget returned 5.
 * opkg_download_backend: Failed to download https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/cortexa8hf-neon/Packages.gz, wget returned 5.
 * opkg_download_backend: Failed to download https://updates.victronenergy.com/feeds/venus/release/packages/dunfell/beaglebone/Packages.gz, wget returned 5.
root@beaglebone:~#
Venus OS
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

If I recall correctly, time sync is taken care of by Connman.

Or conman.

But: thats a nightmare to deal with :-).


The code that includes it into Venus OS, plus long series of patches, is here:


https://github.com/victronenergy/meta-victronenergy/tree/master/meta-alternatives/recipes-connectivity/connman



7 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

smallsolar avatar image smallsolar commented ·
That link is broken for me anyone else?

I am also having a time sync issue with Venus OS on a RPI, so i am strying to figure out how connman is configured because the time is not properly syncing on my device.

0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ smallsolar commented ·
I fixed the link
1 Like 1 ·
sam-carleton avatar image sam-carleton commented ·

Thank you for enlightening me to connman, I see that is installed on my Venos OS, I found the /etc/connman/main.conf file and the first FallbackTimeservers is pool.ntp.org, but the time is still 1970. I double-checked and it can ping things on the Internet, so I am not sure what exactly I need to do to get the ntp client to set the time correctly. Any thoughts?

0 Likes 0 ·
smallsolar avatar image smallsolar sam-carleton commented ·
I'm in a very similar boat. I have poked around in connman, using the connmanctl command to add a custom timeserver, and view the clock settings in connman, but can't seem to get connman to actually synchronize the time. It says it is turned on auto, but until I manually set the time using the Remote Console for Venus OS mine was out by 2 weeks which caused VRM data to log incorrectly. Once I set it, it logs properly now, but it is only a matter of time until it drifts again because the auto sync isn't working.


As a temporary solution you can try setting the local time manually in the Remote Console settings like I did as that changed my RPI system time as well.


0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ smallsolar commented ·
sounds like somehow Connman is not able to sync the "system time" with the time that it reads remotely.


Note that there are two "system times"; took me a while many years ago to get my head around it:
1. time kept in a Real Time Clock (RTC), usually battery powered, somewhere on the PCB. We have that in GX devices. If a rpi has that or not is something I don't know. usually doesn't have any significant drift.

2. time kept in linux itself, has drift.

which or what connman syncs, and how, is something I don't remember now; but will be explained in its documentation, manuals, and rest of google.


have a good sunday!

Matthijs

0 Likes 0 ·
smallsolar avatar image smallsolar mvader (Victron Energy) ♦♦ commented ·

Yes, RPI devices (and I suspect the beaglebone the OP has) do not have a RTC and need to sync with the internet, which is why when connman malfunctions and fails to sync the time it can cause some issues. As far as I know connman syncs the system time.


I have been through all the logs (/data/log/messages and dmesg) and cannot find any error messages related to connman syncing time. To be honest, there is no indication in those logs that connman is even syncing time, even though it is enabled in connmanctl. I am beginning to think something is corrupted with my connman service, and tried a system update to 2.93 to no avail.

At this point unless I find a smoking gun, I may just install ntpd and set a cron job to sync the time with that as I cannot find anything helpful online regarding debugging connman's syncing as it does not seem to be widely used.

Either that or if anyone knows a command to re-install connman on venus os without breaking anything, I could try that.


0 Likes 0 ·
mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ sam-carleton commented ·
I wouldnt know. Check dmesg, check the other message log in /data/logs.


Check if there is a connman log somewhere.



Note that I moved this thread to Modifications space.

0 Likes 0 ·
smallsolar avatar image
smallsolar answered ·

In case anyone else is struggling with time sync issues on RPIs, here is my update, as I had to basically figure this out again after a Venus update. I tried and tried to get connman to do its job and sync the time, and it was not working for whatever reason. I used connmanctl to set a timeserver manually (I can see the timeserver in the ethernet adapter settings file) but despite multiple reboots, connman is not successfully syncing time. There are no logs in /data/logs/messages regarding connman doing time sync at all. I came across this post:

https://community.victronenergy.com/questions/175739/sync-time-rpivenusos-after-boot.html

This was linked in a couple other posts about NTP on the forum here, but people said setting up a second time sync service wasn't a good idea as they may conflict. So I went back to trying to figure out connman again, but couldn't get anywhere. I then decided if connman wasn't working, there couldn't be a conflict between time servers right? ;) So I just followed the steps in the above post and now my system is successfully syncing time with ntp servers using "ntpdate".

I then also installed ntp (ntpd) as ntpdate is usually only meant for system start. Admittedly, I probably could have just skipped the ntpdate step, but I like backups.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources