Page 1 of 3
wrong system time after reboot
Posted: Fri Jul 09, 2021 9:24 pm
by sprante
I have the problem that the system time is not set correctly after a reboot.
In the /home/setup.sh script, the date and time should be taken from meteobridge.com with the following command sequence.
# get current date/time
echo "get date" >$SF
date -u -s "`wget -q -t 2 -T 7 -O - '
http://content.meteobridge.com/cgi-bin/utc.pl'`" >/dev/null 2>/dev/null
echo "read time from meteobridge server: `date`"
This does not work, however, in the log file /var/log/setup.log the date command in the last echo line returns a time from the past, possibly weeks or months old (apparently the time of the last reboot before the current reboot).
Here are the first seven lines in /var/log/setup.log
### setup.sh
Hardware: RPI3
LED path: /sys/class/leds/led1
Reseller:
Command failed: Not found
read time from meteobridge server: Fri Jul 7 22:26:08 CEST 2021
get IP tracker information.
Maybe the "Command failed: Not found" in front of the line "read time from meteobridge server ..." has something to do with it?
My meteobridge installation:
Plattform: Raspberry Pi 3 Model B+
SW-Version: Meteobridge 5.1 (Jul 8 2021, build 2188)
Klaus
Re: wrong system time after reboot
Posted: Sat Jul 10, 2021 12:30 pm
by admin
Is it constantly not working or just a singular glitch?
May be the connection to the Meteobridge server failed and by that no date update can be applied?
Re: wrong system time after reboot
Posted: Sat Jul 10, 2021 12:59 pm
by sprante
The error occurs reliably with every reboot.
If I log in as root immediately after the reboot, the date command with the wget call is executed on the shell without problems and the system time is set correctly.
I tried to analyze the problem further by adding additional echo messages to the /home/setup.sh script. But the changed script is overwritten with the original script when the system is restarted.
Klaus
Re: wrong system time after reboot
Posted: Mon Aug 16, 2021 3:32 pm
by jpouyaud
Hi
I've the same behavior
I set the Date is shell
reboot
and the date is drifted 2 days in the past with a wrong time also
Do we have an ntpd running ?
we should ntpdate after the boot and sync ntpd
Re: wrong system time after reboot
Posted: Mon Aug 16, 2021 3:36 pm
by jpouyaud
here is my /var/log/setup.log now 16 august 2021 15:35
### setup.sh
Hardware: RPI3
LED path: /sys/class/leds/led1
Reseller:
Command failed: Not found
read time from meteobridge server: Sat Aug 14 14:32:58 UTC 2021
get IP tracker information.
error: cannot get TimeLine
no database integrity test requested.
Starting databased... done.
database daemon started... done
load meteotemplate... done
load hwstemplate... done
load hwstemplate2... done
load swisstemplate... done
Starting wnetd... done.
weather network daemon started.
Starting loggerd... done.
data logger started
GW1000s:
WLLs:
OBSIPs:
WLIPs:
Aircams:
PurpleAir:
Luftdaten:
WS980:
sleep 0 secs
Re: wrong system time after reboot
Posted: Mon Aug 16, 2021 3:57 pm
by admin
Just tested on RPI 3b, RPI 3b+ and RPI 4 and works fine on both. Please remember that it needs a reboot when having changed time zone.
Re: wrong system time after reboot
Posted: Mon Aug 16, 2021 4:18 pm
by admin
Are you going through a proxy?
Re: wrong system time after reboot
Posted: Mon Aug 16, 2021 4:35 pm
by admin
Just released update will make it through any existing proxy, forcing to get fresh data.
Re: wrong system time after reboot
Posted: Tue Aug 17, 2021 9:48 am
by jpouyaud
hello
no proxy used here.
I will made some other test, one of the test worked yesterday, the RPI is now with the good time
Re: wrong system time after reboot
Posted: Tue Aug 17, 2021 12:43 pm
by admin
I made a change that when requesting the current date/time from Meteobridge server via HTTP the URL also includes an additional random pattern that will force any proxy in between to really ask the Meteobridge server and not present a former reply from the proxy cache.
Re: wrong system time after reboot
Posted: Mon Oct 25, 2021 10:02 pm
by jpouyaud
Hi
I'm still impacted by this problem
today, I've rebooted my raspberry, and the system date was set to Tue Aug 24 2021
we have a big probleme here..
It's took me the day to discover this
so the metobridge has ruined my collection data for 21 august 2021
come on. we should stop with this buggy script and just follow best practive (ntpdate and ntpd )
Re: wrong system time after reboot
Posted: Mon Oct 25, 2021 10:05 pm
by jpouyaud
this is my /var/log/setup.log just after a reboot right now
also, after 3 reboot, 1 was a big fail with the Rpi not booting at all
### setup.sh
cat: can't open '/var/TZ': No such file or directory
Hardware: RPI3
LED path: /sys/class/leds/led1
Reseller:
Command failed: Not found
tr: write error: Broken pipe
head: standard output: I/O error
read time from meteobridge server: Tue Aug 24 09:02:14 UTC 2021
get IP tracker information.
error: cannot get TimeLine
no database integrity test requested.
Starting databased... done.
database daemon started... done
load meteotemplate... done
load hwstemplate... done
load hwstemplate2... done
load swisstemplate... done
Starting wnetd... done.
weather network daemon started.
Starting loggerd... done.
data logger started
Re: wrong system time after reboot
Posted: Mon Oct 25, 2021 10:39 pm
by jpouyaud
ok looks like the date of 24 august correspond to my last backup DB and reboot...
annoying,
that means I've no data in backup
Re: wrong system time after reboot
Posted: Tue Oct 26, 2021 6:08 pm
by jpouyaud
Hi
here some more info which would help to solve this very annoying bug
I'm experiencing some small improvement by adding a delay of 1 minute for start boot
now the date is the right one, but the time is 5 to 15 minute in the past, a drift of 15 minute in other word
here is the log
### setup.sh
cat: can't open '/var/TZ': No such file or directory
Hardware: RPI3
LED path: /sys/class/leds/led1
Reseller:
Command failed: Not found
tr: write error: Broken pipe
head: standard output: I/O error
read time from meteobridge server: Tue Oct 26 15:33:27 UTC 2021
get IP tracker information.
error: cannot get TimeLine
no database integrity test requested.
Starting databased... done.
database daemon started... done
load meteotemplate... done
load hwstemplate... done
load hwstemplate2... done
load swisstemplate... done
Starting wnetd... done.
weather network daemon started.
Starting loggerd... done.
data logger started
GW1000s:
WLLs:
OBSIPs:
WLIPs:
Aircams:
PurpleAir:
Luftdaten:
WS980:
sleep 0 secs
Maybe the prb is with the head command which return an error ?
Like @sprante, if I run the command date -u -s "`wget -q -t 2 -T 7 -O -
http://content.meteobridge.com/cgi-bin/utc.pl?rand=$RAN
DOM`" the date is well changed...
Re: wrong system time after reboot
Posted: Tue Nov 02, 2021 10:41 pm
by jpouyaud
Hi
would be great to have some support here
the reboot is not safe with RPI and will not correctly preserve the time/date
thanks