ironsheep / RPi-Reporter-MQTT2HA-Daemon

Linux service to collect and transfer Raspberry Pi data via MQTT to Home Assistant (for RPi Monitoring)
GNU General Public License v3.0
441 stars 62 forks source link

systemd timeout - start of service timed out (no RPI in MQTT) #125

Open anderl78 opened 6 months ago

anderl78 commented 6 months ago

Hello! At first, thank you for your hard work! Exactly what I need! :-) I write the following for others with the same problem, perhaps it helps... or perhaps @ironsheep can integrate this, cause I can't see any negative side effects an all my RPIs...

On RPI ZERO W the startup of the service timed out. In consequence the MQTT broker never get the sensores, it fails with "systemd failed to start RPi Reporter MQTT Client/Daemon". Problem is, as far as i have seen, that the service regulary timed out after 30 sec.. the single-core RPI is too slow...

Check it with: sudo systemctl show isp-rpi-reporter.service -p TimeoutStartUSec sudo systemctl show isp-rpi-reporter.service -p TimeoutStopUSec --> You should see 30 sec timeout --> You can change this 120 sec. to fix it, if you have the same problem:

  1. During setup, before registering the service in /opt/RPi-Reporter-MQTT2HA-Daemon/isp-rpi-reporter.service file:

[Service] Type=notify ... TimeoutSec=120

  1. If the setup is already done, you have to change the service with:

sudo systemctl stop isp-rpi-reporter.service sudo systemctl edit --full isp-rpi-reporter.service

--> add:

[Service] Type=notify ... TimeoutSec=120

  1. Save and exit, reboot and check with...

sudo journalctl -b --no-pager -u isp-rpi-reporter.service

...if the service is up. Btw, "TimeoutSec" set's the time for "TimeoutStartSec" and "TimeoutStopSec" in one.

ironsheep commented 6 months ago

I'll look into this - be it doc change or detection on startup; we'll see. Thanks for pointing this out!