Page 1 of 1

Why raspberry pi go offline after few hours or days

Posted: Tuesday 08 November 2022 16:02
by Dave47
Hi,

I have Rasberry pi with Domoticz on it.
After few hours or days my Rasberry Pi go completly offline.

What i do is turn the power off and on from the raspberry.
Sometimes it work than.
I usually have to do the same with the router.

Then i can go in ssl to the rasberry with the wifi ip adres.
The Lan connection is not always ready.

Domoticz doesn't work yet.

I still have to restart Domitcz with: sudo service domoticz.sh restart

Is this a router problem or what can we try?

Is there maybe a script to start Domoticz automatically?
How can we solve the connection problem from the PI?

We have Rasbian Buster version 10 on the Pi

Re: Why raspberry pi go offline after few hours or days

Posted: Tuesday 08 November 2022 18:25
by willemd
Sounds like a networking issue, not a Domoticz issue.

You normally have access via WIFI and LAN?
When the Pi is offline, are both WIFI and LAN connection failing?
Can you ping the Pi then?

What if you don't reset the PI but only the router?
What if you bring the PI and router closer together?

Is this the only router in your network?

You can set up MONIT to monitor and restart Domoticz, but if it is a networking problem then this will not solve your problem.
https://www.domoticz.com/wiki/Monitoring_domoticz

Re: Why raspberry pi go offline after few hours or days

Posted: Tuesday 08 November 2022 19:34
by Dave47
We have 2 routers. The second is only accesspoint and i need for ip camera.
The lan connecties is coming from router/modem 1 with static lease for lan.
I have setup a lan and wifi connection. Sometimes wifi is ok and sometimes the lan. Both is most of the time.
In router 1 ip wifi and lan is static.
The wifi ssid radio signal is from accespoint/router 2 but the ip from 1.
Raspberry pi is close to router 2.
Maybe the wire from router 1 to router2 is the problem?
With other devices no problem

Restart domoticz was the first problem. When i make a reboot for the pi is always have to do a restart for domoticz.

Re: Why raspberry pi go offline after few hours or days

Posted: Thursday 10 November 2022 9:30
by lost
Dave47 wrote: Tuesday 08 November 2022 19:34 Restart domoticz was the first problem. When i make a reboot for the pi is always have to do a restart for domoticz.
Having to manually restart Domoticz after a reboot is IMO the usual issue with lack of RTC on raspberries... Domoticz start must be delayed after NTP is available. Otherwise a domoticz timeout/watchdog triggers at restart. Search forum/wiki for solutions.

Also advise you to setup domoticz to log in a file & check /var/log/syslog (+ .1, .2.gz etc logrotated files, ; you can use zcat/zmore/zgrep instead of cat/more/grep to see/search for errors in older gz compressed files), to understand better if your first issue is really linked with Domoticz/PI (enough power? SD storage dying?) or network related: A few checks on routers (there must be a setup interface?) may also help.

Not clear also if your PI connection is wired or wifi? If wired, you may try unplug/replug connector to see if this brings network back?

For such permanent connection, wifi is IMO not advised... If this is wireless issues, you may monitor PI or AP (if some logging available, my Microtik offers lots of information but that's not the case for more consumer market brands): If you see many deauth, you may have a script kiddie in your neighborhood! Would be an easy way to silent your IP cams for someone willing to get in, also: Some portable devices sending continuous deauth to anything wifi connected in range are quite common nowadays.

My own PI uptime with Domoticz must be over 2 months now (due to last kernel update)... Probably the same for most users here.

Re: Why raspberry pi go offline after few hours or days

Posted: Thursday 10 November 2022 14:42
by willemd
Dave47 wrote: Tuesday 08 November 2022 19:34 We have 2 routers. The second is only accesspoint and i need for ip camera.
The lan connecties is coming from router/modem 1 with static lease for lan.
I have setup a lan and wifi connection. Sometimes wifi is ok and sometimes the lan. Both is most of the time.
In router 1 ip wifi and lan is static.
The wifi ssid radio signal is from accespoint/router 2 but the ip from 1.
Raspberry pi is close to router 2.
Maybe the wire from router 1 to router2 is the problem?
With other devices no problem

Restart domoticz was the first problem. When i make a reboot for the pi is always have to do a restart for domoticz.
I had a similar setup and the same problem. Never found out why, but from the moment I forced the raspberry to connect to the main router the networking problems were gone. If the raspberry connected to the second access point then at a certain point the connection was lost.

Re: Why raspberry pi go offline after few hours or days

Posted: Thursday 10 November 2022 17:03
by lost
willemd wrote: Thursday 10 November 2022 14:42 I had a similar setup and the same problem. Never found out why, but from the moment I forced the raspberry to connect to the main router the networking problems were gone. If the raspberry connected to the second access point then at a certain point the connection was lost.
Networking Problems:
https://xkcd.com/2259/

:lol: :x

Re: Why raspberry pi go offline after few hours or days

Posted: Friday 18 November 2022 13:02
by Dave47
Hallo Willemd. How didi you forced the Raspberry to connect with the main router? Did you connect with wifi in the beginning on router 2 or LAN?
Is the connection on the main a LAN connection?

Re: Why raspberry pi go offline after few hours or days

Posted: Friday 18 November 2022 14:21
by willemd
Dave47 wrote: Friday 18 November 2022 13:02 Hallo Willemd. How didi you forced the Raspberry to connect with the main router? Did you connect with wifi in the beginning on router 2 or LAN?
Is the connection on the main a LAN connection?
Initially both the network SSID of the main router and the SSID of the second access point were defined in the wpa_supplicant configuration file on the raaspberry. To force the main router connection I just removed the definition of the second access point.

Re: Why raspberry pi go offline after few hours or days

Posted: Saturday 19 November 2022 11:26
by FlyingDomotic
Did you tried to have a look at /var/log/syslog after the crash/disconnection, to see what happened before you restart it? If disk/SSD was not the issue, main reason is probably written here.

If this is a disk issue, you can still have a proof forwarding your syslog message to another machine with a syslog server, as network will stay up (but new connections will probably be refused).

As other said, you should avoid Wifi, especially if a wired connection is available. And effectively, unless you need to restart RPi by your own, it generally stays on for months.

Re: Why raspberry pi go offline after few hours or days

Posted: Wednesday 21 December 2022 12:11
by Dave47
If this is a disk issue, you can still have a proof forwarding your syslog message to another machine with a syslog server, as network will stay up (but new connections will probably be refused).
I have no other machine. But how can you do this?
Is the reason to see whether this is a disk problem or not?