Git Product home page Git Product logo

Comments (3)

stefanwichmann avatar stefanwichmann commented on July 25, 2024

Hi John,

thanks for reporting this issue. Since Kelvin doesn't do any good without the network being up, we should definitely take care of this issue.

My first take after reading the systemd documentation (https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/) would be to change the dependency in the service file from After=network.target to After=network-online.target. This should delay the startup of Kelvin until there is a working network.

Could you try this on the machine where you discovered the problem. This way we could directly verify the fix.

A next step would be to handle network failures more gracefully in the future.

from kelvin.

tinamil avatar tinamil commented on July 25, 2024

That did not resolve the issue, behavior was identical. I also tested adding Wants=network-online.target, but it also had no effect.

It looks like network-online target is not enabled by default for the PI:

pi@eqraspberry:~ $ sudo systemctl is-enabled  systemd-networkd-wait-online.service
disabled

Based on https://unix.stackexchange.com/questions/353179/why-isnt-my-systemd-service-waiting-for-the-network I then tried changing the kelvin.service to restart on failure after 5 seconds, instead of restart on abort.

My new kelvin.service file looks like:

# /etc/systemd/system/kelvin.service
# service file for Kelvin - The hue bot
# https://github.com/stefanwichmann/kelvin

[Unit]
Description=Kelvin
After=network-online.target

[Service]
Type=simple
User=pi
WorkingDirectory=/home/pi/kelvin
ExecStart=/home/pi/kelvin/kelvin
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

And it worked:

pi@eqraspberry:~ $ journalctl -u kelvin
-- Logs begin at Wed 2018-07-18 10:41:43 CDT, end at Wed 2018-07-18 10:44:19 CDT. --
Jul 18 10:41:46 eqraspberry systemd[1]: Started Kelvin.
Jul 18 10:41:46 eqraspberry kelvin[259]: time="2018/18/07 10:41:46" level=info msg="Kelvin v1.1.8 starting up... 🚀"
Jul 18 10:41:46 eqraspberry kelvin[259]: time="2018/18/07 10:41:46" level=info msg="⚙ Configuration /home/pi/kelvin/config.json loaded"
Jul 18 10:41:46 eqraspberry kelvin[259]: time="2018/18/07 10:41:46" level=info msg="Looking for updates..."
Jul 18 10:41:46 eqraspberry systemd[1]: kelvin.service: Main process exited, code=exited, status=1/FAILURE
Jul 18 10:41:46 eqraspberry systemd[1]: kelvin.service: Unit entered failed state.
Jul 18 10:41:46 eqraspberry systemd[1]: kelvin.service: Failed with result 'exit-code'.
Jul 18 10:41:51 eqraspberry systemd[1]: kelvin.service: Service hold-off time over, scheduling restart.
Jul 18 10:41:51 eqraspberry systemd[1]: Stopped Kelvin.
Jul 18 10:41:51 eqraspberry systemd[1]: Started Kelvin.
Jul 18 10:41:51 eqraspberry kelvin[385]: time="2018/18/07 10:41:51" level=info msg="Kelvin v1.1.8 starting up... 🚀"
Jul 18 10:41:51 eqraspberry kelvin[385]: time="2018/18/07 10:41:51" level=info msg="Looking for updates..."
Jul 18 10:41:51 eqraspberry kelvin[385]: time="2018/18/07 10:41:51" level=info msg="⚙ Configuration /home/pi/kelvin/config.json loaded"
Jul 18 10:41:51 eqraspberry systemd[1]: kelvin.service: Main process exited, code=exited, status=1/FAILURE
Jul 18 10:41:51 eqraspberry systemd[1]: kelvin.service: Unit entered failed state.
Jul 18 10:41:51 eqraspberry systemd[1]: kelvin.service: Failed with result 'exit-code'.
Jul 18 10:41:56 eqraspberry systemd[1]: kelvin.service: Service hold-off time over, scheduling restart.
Jul 18 10:41:56 eqraspberry systemd[1]: Stopped Kelvin.
Jul 18 10:41:56 eqraspberry systemd[1]: Started Kelvin.
Jul 18 10:41:57 eqraspberry kelvin[474]: time="2018/18/07 10:41:57" level=info msg="Kelvin v1.1.8 starting up... 🚀"
Jul 18 10:41:57 eqraspberry kelvin[474]: time="2018/18/07 10:41:57" level=info msg="Looking for updates..."
Jul 18 10:41:57 eqraspberry systemd[1]: kelvin.service: Main process exited, code=exited, status=1/FAILURE
Jul 18 10:41:57 eqraspberry systemd[1]: kelvin.service: Unit entered failed state.
Jul 18 10:41:57 eqraspberry systemd[1]: kelvin.service: Failed with result 'exit-code'.
Jul 18 10:42:02 eqraspberry systemd[1]: kelvin.service: Service hold-off time over, scheduling restart.
Jul 18 10:42:02 eqraspberry systemd[1]: Stopped Kelvin.
Jul 18 10:42:02 eqraspberry systemd[1]: Started Kelvin.
Jul 18 10:42:02 eqraspberry kelvin[646]: time="2018/18/07 10:42:02" level=info msg="Kelvin v1.1.8 starting up... 🚀"
Jul 18 10:42:02 eqraspberry kelvin[646]: time="2018/18/07 10:42:02" level=info msg="Looking for updates..."
Jul 18 10:42:02 eqraspberry kelvin[646]: time="2018/18/07 10:42:02" level=info msg="⚙ Configuration /home/pi/kelvin/config.json loaded"
Jul 18 10:42:02 eqraspberry kelvin[646]: time="2018/18/07 10:42:02" level=info msg="Webinterface started on port 8080"
Jul 18 10:42:02 eqraspberry kelvin[646]: time="2018/18/07 10:42:02" level=info msg="⌘ Connection to bridge established"

from kelvin.

stefanwichmann avatar stefanwichmann commented on July 25, 2024

Hi John,

thanks for finding a solution and testing it! Your help is really appreciated.

I adopted your change to the service configuration. It will be part of the next release.

from kelvin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.