wrong system time after reboot

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

sprante
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: Wed Jan 20, 2010 9:23 pm
Contact:

wrong system time after reboot

Post 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
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: wrong system time after reboot

Post 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?
sprante
Fresh Boarder
Fresh Boarder
Posts: 18
Joined: Wed Jan 20, 2010 9:23 pm
Contact:

Re: wrong system time after reboot

Post 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
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: wrong system time after reboot

Post 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.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: wrong system time after reboot

Post by admin »

Are you going through a proxy?
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: wrong system time after reboot

Post by admin »

Just released update will make it through any existing proxy, forcing to get fresh data.
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: wrong system time after reboot

Post 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.
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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 )
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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...
jpouyaud
Junior Boarder
Junior Boarder
Posts: 35
Joined: Sun Sep 19, 2010 2:53 pm

Re: wrong system time after reboot

Post 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
Post Reply