Raspian Stretch and timesyncd

80 views
Skip to first unread message

bell...@gmail.com

unread,
Mar 12, 2019, 2:39:22 PM3/12/19
to weewx-user
It seems that in Raspian Stretch, timesyncd is enabled by default. And, it too attempts to read the date/time from a file when booting. I had removed fake-hwclock, but still had some problems with the date/time on reboot. Looking into syslog I saw the following
Mar 11 15:39:47 xxxx systemd-timesyncd[342]: System clock time unset or jumped backwards, restoring from recorded timestamp: Mon 2019-03-11 15:39:46 EDT
I ended up disabling timesyncd via
sudo systemctl disable systemd-timesyncd
and installing ntpd via
sudo apt-get install ntp

On reboot I now see that weewx is "Waiting for sane time.". Hope this helps others who might not have installed an RTC.
Rich

Thomas Keffer

unread,
Mar 12, 2019, 3:53:45 PM3/12/19
to weewx-user
Good observation!

I added some notes to the Wiki article on RPi time.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vince

unread,
Mar 12, 2019, 4:48:34 PM3/12/19
to weewx-user
On Tuesday, March 12, 2019 at 11:39:22 AM UTC-7, bell...@gmail.com wrote:
I ended up disabling timesyncd via
sudo systemctl disable systemd-timesyncd
and installing ntpd via
sudo apt-get install ntp



Yes - systemd will run its own (not so good) time sync function by default.  You really don't have to disable it, if you install ntpd systemd detects that and lets ntpd drive things re: time.

Thomas Keffer

unread,
Mar 12, 2019, 6:20:15 PM3/12/19
to weewx-user
But, does it still record the time and try to use that on startup?

-tk

--

vince

unread,
Mar 12, 2019, 10:44:26 PM3/12/19
to weewx-user

On Tue, Mar 12, 2019 at 1:48 PM vince <vince...@gmail.com> wrote:

Yes - systemd will run its own (not so good) time sync function by default.  You really don't have to disable it, if you install ntpd systemd detects that and lets ntpd drive things re: time.



On Tuesday, March 12, 2019 at 3:20:15 PM UTC-7, Thomas Keffer wrote:
But, does it still record the time and try to use that on startup?

 
I don't know....
Certainly no harm in disabling it in systemd to try to make sure, but then also do the normal disabling of fake-hwclock too I guess.

Bottom line is we probably want a system with no battery-backed-up clock to power up cleanly with a time old enough so weewx does its "wait for good time before starting" thing.   That was something like 'wait until the system clock is newer than the modification date of weewx.conf' or the like, wasn't it ?

This stuff'll make you crazy.

G Hammer

unread,
Mar 13, 2019, 9:43:43 AM3/13/19
to weewx-user
I've been a fan of chrony.
Hasn't been a problem on any system I've installed it on, easier (for me) to configure and monitor.

David Beach

unread,
Mar 13, 2019, 10:29:21 AM3/13/19
to weewx-user
Someone who is a Raspian expert can correct me on this if I'm wrong: 

I seem to recall that Raspian, if stripped of fake-hwclock, etc., does NOT start up with the universal Linux Jan 1970 date but uses a date that corresponds to the release date of that version of Raspian.  This means that programs/scripts that rely on looking for an "old" date (say, pre-2000 or pre-1990) as an indication of a 'bad' time setting won't work properly.

However, I can't remember where I stumbled on this nor does a quick Google search help me. I don't want to spread bad information. Can anyone confirm/refute this?

David

vince

unread,
Mar 13, 2019, 1:04:29 PM3/13/19
to weewx-user
On Wednesday, March 13, 2019 at 7:29:21 AM UTC-7, David Beach wrote:
I seem to recall that Raspian, if stripped of fake-hwclock, etc., does NOT start up with the universal Linux Jan 1970 date but uses a date that corresponds to the release date of that version of Raspian.  This means that programs/scripts that rely on looking for an "old" date (say, pre-2000 or pre-1990) as an indication of a 'bad' time setting won't work properly.

However, I can't remember where I stumbled on this nor does a quick Google search help me. I don't want to spread bad information. Can anyone confirm/refute this?

 
It's pretty easy to do experimentally.   Find a sacrificial pi with just an os there.  Yank the power.  Power it up.  Check its date.

The weewx check is in engine.py at around line 845.  It waits until the system time is later than the creation time of the weewx.conf file.   So it probably doesn't really matter what time any runtime system comes up with before some ntp(ish) or realtime clock things gets the os an accurate date and time.


bell...@gmail.com

unread,
Mar 14, 2019, 6:20:13 PM3/14/19
to weewx-user
It does appear that removing fake-hwclock and installing ntp might enough. On a new install, I removed fake-hwclocked, installed ntp, and disabled networking. On reboot the time stayed at the "default".
My net, if you are running WeeWX on a computer without an RTC, do your homework... read the logs, test network slowness/failures, etc.  
Or just spring for a RTC ;)
rich


On Tuesday, 12 March 2019 22:44:26 UTC-4, vince wrote:

David Beach

unread,
Mar 14, 2019, 6:40:41 PM3/14/19
to weewx...@googlegroups.com
I *did* spring for a hardware RTC (a 3231). However, I still had problems and, because of other commitments (like my work, etc!), I did not further investigate why this should be so. Maybe when I get more free time, I'll troubleshoot. In the meantime, I just stuck my RPi on a spare UPS to avoid reboots!

David

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/_kuJsQBQghM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages