Raspberry second boot after 1 Minute

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
Jubbes
Posts: 33
Joined: Wednesday 24 October 2018 14:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Raspberry second boot after 1 Minute

Post by Jubbes »

Hello, if my Raspberry reboots after an unexpected power failure, Domoticz will not start automatically because of a date problem with the Raspberry. Only after a renewed reboot Domoticz then also starts. How can I teach the Raspberry when it boots after about 1 minute to make a sudo reboot?
Many Easter greetings, Jubbes
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Raspberry second boot after 1 Minute

Post by waaren »

Jubbes wrote: Sunday 21 April 2019 9:59 Hello, if my Raspberry reboots after an unexpected power failure, Domoticz will not start automatically because of a date problem with the Raspberry. Only after a renewed reboot Domoticz then also starts. How can I teach the Raspberry when it boots after about 1 minute to make a sudo reboot?
Can you please elaborate on what the date problem is ? Maybe it can be solved by setting the right time-zone using

Code: Select all

sudo raspi-config 
That will be easier than to create a script that will reboot your raspberry after a recovery from a power failure
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Jubbes
Posts: 33
Joined: Wednesday 24 October 2018 14:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Raspberry second boot after 1 Minute

Post by Jubbes »

Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Raspberry second boot after 1 Minute

Post by waaren »

Jubbes wrote: Sunday 21 April 2019 13:18 Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.
On raspberry this type of date problems can be prevented by the fake-hwclock package. This package ensure date / time is not to far off even when no access to NTP servers yet.

Code: Select all

sudo apt-get update
sudo apt-get install fake-hwclock
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Jubbes
Posts: 33
Joined: Wednesday 24 October 2018 14:35
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Raspberry second boot after 1 Minute

Post by Jubbes »

OK, thanks you. I will test it.
zzaal
Posts: 1
Joined: Friday 08 March 2019 17:59
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Russia
Contact:

Re: Raspberry second boot after 1 Minute

Post by zzaal »

Hi
I have the same problem
I decided it so

edit the file: etc/rc.local

add two lines to the end of the file

sleep 20
sudo service domoticz.sh restart


where: sleep 20 -delay in seconds

it starts Domoticz again after 20 sec.

here is an example of the finished file:

Code: Select all

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi
sleep 20
sudo service domoticz.sh restart
exit 0 
sorry for my bad english...
Estebus
Posts: 3
Joined: Sunday 01 July 2018 20:43
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Raspberry second boot after 1 Minute

Post by Estebus »

waaren wrote: Sunday 21 April 2019 13:36
Jubbes wrote: Sunday 21 April 2019 13:18 Rasberry starts with a date from 1970 or so and then gets the current date over the Internet. Domoticz does not get along with the year 1970 and stops the starting process. In a sudo reboot but then the current year is read and domoticz can start normally. that's why I would like to start the raspi 2 x so that domoticz started. Under raspi-config everything is set correctly.
On raspberry this type of date problems can be prevented by the fake-hwclock package. This package ensure date / time is not to far off even when no access to NTP servers yet.

Code: Select all

sudo apt-get update
sudo apt-get install fake-hwclock
In my case this problem was in lot of situation. Only solution was to restart the domoticz service after each reboot.

Thanks a lot for this solution. fake-hwclock was already installed for me but, by default, make a save each hours, that was not enough. I added a bash for cron in order to force a save each 5 secondes and i don't have problem anymore.

Br,
User avatar
waltervl
Posts: 5905
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Raspberry second boot after 1 Minute

Post by waltervl »

Just for the reference, some more options to get over the Domoticz crash after a cold boot can be found in the wiki:
https://www.domoticz.com/wiki/Troublesh ... _cold_boot
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest