I had EVERYTHING working the way it should. I made the mistake of updating and ONCE AGAIN I cannot get GPS fix and set the time automatically using CHRONY. I tried using the same settings that I had on my GPSD.conf and CHRONY.conf from the prior install, and those don't work either.
Last straw, I am DONE with INDI, going back to my reliable and WORKING WIN10 PC stick and SGP. Worst $50 I have ever spent.
Kaczorek wrote:Why would you say this? The only difference is that without PPS you will not get precision higher than 1s, while with PPS your time precision is around 1us. All the rest would work just fine.
knro wrote: Ok so I did a little bit more research and turns out using GPS for NTP is useless unless your GPS unit provides precise timing via PPS.
@SparkyHT I read your thread on CHRONY... well done!
knro wrote: So I spent a few hours on this and finally go it working reliably. You'll receive a link to an updated StellarMateOS image by the end of the day. Do not edit any files, just use the StellarMate Serial Port Assistant tool to add the GPS and then restart your StellarMate afterwards and you should be set.
Well after a Sunday afternoon of research and testing, I found a way to set the system time on my OFFLINE RPI3 with GPSD at boot using CHRONY. It's reliable and sets the system time within a minute and a half of the OS loading. After launching KSTARS and going to EKOS and connecting to my equipment, I go to the GPSD tab to SYNC the device (i.e. my AP driver) to the current location and time by clicking "Update". On the EKOS side of things the UTC time and GPS location is correct, my AP mount sets to the proper time and the UTC offset is set to -5 which is correct for my area as we are still in DST for one more week. Here's the problem: KSTARS goes from the time set by the system and in EKOS set by the GPS, to one hour ahead! The geographic information in KSTARS is set to my city, the UTC offset is -6, and the DST rules are set for US. KSTARS is changing the time as though I am not observing DST, regardless of the geographic settings. I have a screenshot below of what I'm seeeing. Is this a bug?
knro wrote: Ok so I did a little bit more research and turns out using GPS for NTP is useless unless your GPS unit provides precise timing via PPS. The majority of GPS dongles don't support this. Check if your is supported here: www.catb.org/gpsd/hardware.html
I configured NTP to use GPS on StellarMate, and when I ran ntpq -p, I got this:
stellarmate@stellarmate:~$ ntpq -p
remote refid st t when poll reach delay offset jitter
0.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.001
1.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.001
2.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.001
3.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.001
ntp.ubuntu.com .POOL. 16 p - 64 0 0.000 0.000 0.001
SHM(0) .GPS. 0 l - 16 0 0.000 0.000 0.000
SHM(1) .PPS. 0 l - 16 0 0.000 0.000 0.000
+sv1.localdomain 188.8.131.52 2 u 28 64 17 194.561 1.265 10.837
*time.iqnet.com 184.108.40.206 2 u 26 64 17 176.547 10.442 14.519
+x.ns.gin.ntt.ne 249.224.99.213 2 u 29 64 7 157.242 8.576 3.270
hachi.paina.net 220.127.116.11 2 u 86 64 2 241.538 21.487 2.448
-mail.lumajangka 18.104.22.168 3 u 25 64 7 330.810 5.412 3.812
-22.214.171.124 ( 126.96.36.199 2 u 19 64 7 231.419 1.184 1.969
-one.itnet.am 188.8.131.52 2 u 26 64 7 171.718 10.273 1.899
It's using online NTP servers even though I attached a GPS and it can "read" from it, but because it doesn't have PPS, it's useless. So I'd say just use GPS NMEA driver for time synchronization. The ones that provide PPA can be pretty expensive and not really worth it unless you're need nanosecond timings.
I still don't have a fix for this. I removed timesyncd service and reinstalled NTP and I'm still getting the failed to start errors. It appears I'm screwed trying to use my RPI3 out in the field because it'll never have the right time. Making this work shouldn't have to be so difficult. I thought switching from Win10 to INDI meant freedom, flexibility, and reliability, it has been anything but. I have yet to get a successful clear night out with it. Driver issues from the start, and now foiled by trying to set something as basic and essential as a clock. I guess I didn't realize I had to be a Linux master to make INDI work for me.
Umm, it appears that timesyncd is NOT a part of MATE 16.04 Pi. rm /etc/systemd/system/systemd-timesyncd.service yields:
cannot remove '/etc/systemd/system/systemd-timesyncd.service' : No such file or directory
So now I'm still baffled what is killing NTP. This may all be for naught, I read something about NTP not being able to grab time from GPSD at boot because it takes too long to sync. Sigh. Not sure a Pi is ideal for a mobile setup. It's too much of a hassle having to reset time and location every time I power up. Back to the drawing board.
Also knro, I tried sudo dpkg-reconfigure tzdata and was in the right timezone.
Kaczorek wrote: RPi does not have RTC (real time clock) so it boots at 01-01-1970 and needs to set proper time/date from some source. In a standard configuration it uses network to accomplish this goal. For many years NTP service has been used to sync operating system time to network based source. NTPD service also supports non-network sources such as GPSD service, so you can set operating system time even if you don't have Internet connection e.g. from gps device. So it is NTP service that sets your operating system time, not indi-gpsd driver. indi-gpsd driver reads operating system time and timezone to calculate offset and DST - if they are not correct you get the issues exactly you have described.
However NTP service has been replaced by timesyncd service in the recent ubuntu releases (which I believe is insane). For the sake of compatibility, timesyncd disables execution bit on ntpd service at the boot time. As the result NTP service runs fine after reinstallation and will not run after reboot. Moreover timesyncd service requires Internet connection and cannot use gps as a time/date source. To fix it you need to revert from timesyncd service to NTP service to support off-line time/date setting from gps. See example approach here
On a previous thread, I had issues with Ekos polling data from my USB GPS receiver. Well that issue has been fixed. This one is different. I ran some tests last night with the Pi3 running headless (no ethernet /internet) this time and found that although proper location data is retrieved for my area, the time data is not. When I boot the Pi, the system time and date is way off obviously. That time and date information should correct itself once I connect to GPSD in EKOS, both in the mount UTC field and in Kstars, correct? I can see GPSD has got a fix, and latitude/longitude are correct, UTC is set to - 5, but the UTC time field is just a calculation of the incorrect system time +5. The local time in Kstars just sets itself to the system time. Clicking "update" in the GPSD driver doesn't correct things. Very weird behavior. The only way to get time to correct itself is to connect the Pi3 to the internet. cgps shows the correct UTC time after satlock whether offline or online.
Using a tutorial I found, I attempted to see if I can set the system time from GPSD at boot, but I've run into a wall because I'm getting errors from NTP. The NTP daemon will not start and any attempt to start the NTP service exits with the message:
● ntp.service - LSB: Start NTP daemon
Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since pet 2017-03-24 13:24:13 CET; 3s ago
Process: 2092 ExecStart=/etc/init.d/ntp start (code=exited, status=5)
mar 24 13:24:13 tnmtv3 systemd: Starting LSB: Start NTP daemon...
mar 24 13:24:13 tnmtv3 systemd: ntp.service: Control process exited, code=exited status=5
mar 24 13:24:13 tnmtv3 systemd: Failed to start LSB: Start NTP daemon.
mar 24 13:24:13 tnmtv3 systemd: ntp.service: Unit entered failed state.
mar 24 13:24:13 tnmtv3 systemd: ntp.service: Failed with result 'exit-cod
If I apt purge ntp and then reinstall ntp, everything will work... until I reboot. Then the error comes back. This is a relatively fresh Stellarmate install, so. I'm wondering if there is something wrong with MATE 16.04 for the Pi, or maybe a permissions issue?
What I want to know is if either issue is repeatable on other people's Pi3's running offline or is this exclusive to just me? I could care less about the NTP problem if I can just get EKOS/KSTARS to set to the GPS time signal once there is a satellite lock.
I understand if automating such a thing is not an easy thing to do. I guess consider this thread a lessonl on what to do if one has a USB GPS receiver and wants to have it reliably pass data into INDI/EKOS. The Stellarmate Serial Assistant was helpful in making the connection repeatable after reboot.