I just set up a hardware watchdog on YunoHost to monitor my connectivity using the watchdog systemd service. If I can't ping 8.8.8.8 for 30 minutes, it'll trigger a reboot.

I've been having issues where my RPi4 server suddenly lost the internet connection... I disabled EEE, which hopefully fixed that, but having some extra security like this probably won't hurt.

#YunoHost #SelfHosted #Linux #RaspberryPi #SystemD

@bammerlaan it's using a hammer for a fly. check another ip to be sure and check you can access your lan. Check your logs, your ressource with sar. Dont reboot like it's magic, best to investigate and understand. You can reboot everyday if you want but that's for other reason.
Use this workaround for a short time and fix at the source

@Quentin_ctrL Oh, thanks! Well, I did check the logs, and there's nothing really there... As far as I could tell. But some googling did tell me these kinds of issues could stem from the mentioned EEE thing, so that's what I'm trying first.

The watchdog is more a redundancy thing, I figured it couldn't hurt to have something like that running.

Don't misunderstand: this isn't some script that reboots the server every 30 minutes, only if there's no internet connection or some hardware failure.

@Quentin_ctrL If it turns out the issues persist, the next thing I'm trying is setting networkd on debug mode, see if that sheds any light. If you have some more ideas I'm open for suggestions!
@bammerlaan use journalctl and filter by time , severity , unit. Check the load of the rpi ? Maybe the hardware is hot or another hardware issue. Remember if the issue starts after updates.
Can you tell how long before you have network issue ?
In your installed apps, try to figure out which could be related, eventually restart the service related with a timer unit.

@Quentin_ctrL As far as I can tell, the hardware doesn't seem to be overheating... But I did follow your advice to set up sar! Got it running now, so if I do have another problem with the internet connection, I should be able to garner some more information now.

I also set up a systemd service to send me an email if a reboot happened, ideally that will also help me pinpoint when the network issues happen.

For now I'm crossing my fingers that the EEE fix actually worked, though 🤞

@bammerlaan Are you using a static IP address that is only assigned by the router? I was having a problem with multiple pis losing their network connection like that. After setting up the static IP in NetworkManager on the pi itself, things have been stable.

@dwsharp Ah, yes, that was something else I found earlier! I changed that, and in fact thought I'd fixed the problem for a couple of days after that, but it was still losing its internet connection after a while, as it turned out...

In fact, I also found out about the EEE thing earlier, and created a sytemd service to disable it as soon as it booted... The only thing I really changed now was adding "dtparam=eee=off" to my config.txt file, to disable it earlier in the boot process. 🤞

@dwsharp @bammerlaan assign static ip that way, not the best idea. Never heard that kind of issue but try if you have no other idea. It reminds me that with my NUC I always had wifi on in case.