n8henrie/fauxmo

systemd startup issue

Closed this issue · 2 comments

  • Issues not following the template may be closed for that reason alone.
  • Operating system and version: Raspian 4.19.66
  • Python version: 3.7.3
  • Fauxmo version (fauxmo --version): 0.4.9
  • Echo device type (e.g. Echo, Echo Plus, Dot): n/a
  • Echo Firmware Version: n/a

My Issue

When I try to start fauxmo from a systemd service file, I see the following information in the log file:

● myfauxmo.service - Fauxmo
   Loaded: loaded (/etc/systemd/system/myfauxmo.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-09-21 19:25:15 EDT; 13s ago
  Process: 423 ExecStart=/opt/pyenv/versions/3.7.3/bin/fauxmo -c /home/pi/fauxmo_config.json (code=exited, status=1/FAILURE)
 Main PID: 423 (code=exited, status=1/FAILURE)

Sep 21 19:25:14 raspi fauxmo[423]:   File "/opt/pyenv/versions/3.7.3/lib/python3.7/site-packages/fauxmo/cli.py", line 37, in cli
Sep 21 19:25:14 raspi fauxmo[423]:     main(config_path_str=args.config, verbosity=verbosity)
Sep 21 19:25:14 raspi fauxmo[423]:   File "/opt/pyenv/versions/3.7.3/lib/python3.7/site-packages/fauxmo/fauxmo.py", line 64, in main
Sep 21 19:25:14 raspi fauxmo[423]:     fauxmo_ip = get_local_ip(fauxmo_config.get("ip_address"))
Sep 21 19:25:14 raspi fauxmo[423]:   File "/opt/pyenv/versions/3.7.3/lib/python3.7/site-packages/fauxmo/utils.py", line 37, in get_local_ip
Sep 21 19:25:14 raspi fauxmo[423]:     tempsock.connect(("8.8.8.8", 0))
Sep 21 19:25:14 raspi fauxmo[423]: OSError: [Errno 101] Network is unreachable
Sep 21 19:25:15 raspi systemd[1]: myfauxmo.service: Main process exited, code=exited, status=1/FAILURE
Sep 21 19:25:15 raspi systemd[1]: myfauxmo.service: Unit entered failed state.
Sep 21 19:25:15 raspi systemd[1]: myfauxmo.service: Failed with result 'exit-code'.

Is this because my network interface isn't quite ready yet?

I can still start it manually with: nohup /opt/pyenv/versions/3.7.3/bin/fauxmo -c /home/pi/fauxmo_config.json &, but I would prefer to just have it start automatically.

I removed Restart=on-failure from my service startup, because early on, I had a typo in my config.json, and it seemed to be putting my RPi in a state where I couldn't telnet into it (ended up breaking out the monitor/mouse/keybd), presumably because it was rolling restarts my fauxmo service.

Is there a reason Restart=on-failure was added to the .service startup file? Should I re-add it, now that my config.json appears to be configured properly?

WHYT


Please make sure you've taken these steps before submitting a new issue:

  • Try to reproduce the issue with Fauxmo installed in a
    venv
  • Ensure you're running a supported version of Python
    • Requires Python >= 3.2 for Fauxmo < 0.3.0
    • Requires Python >= 3.4.4 for Fauxmo >= 0.3.0
    • Requires Python >= 3.6.0 for Fauxmo >= 0.4.0
  • Run Fauxmo in debug mode (-vvv) and include relevant output
  • Include your Fauxmo config.json
  • Search the existing (including closed) issues
  • Please use codeblocks around your debug output and config

Good to know details on systemd... I ended up adding Restart=on-failure, and it works - thank you!