weewx starting before network?

103 views
Skip to first unread message

Ryan Stasel

unread,
Sep 24, 2022, 12:58:16 PM9/24/22
to weewx-user
Just restarted my weewx Pi, and noticed Weewx wasn't running. Logs show:

Sep 24 09:29:57 raspi-server-misc weewx[528] INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
Sep 24 09:29:57 raspi-server-misc weewx[528] ERROR weewx.drivers.vantage: Socket error while opening port 22222 to ethernet host 10.0.6.23.
Sep 24 09:29:57 raspi-server-misc weewx[528] ERROR weewx.engine: Import of driver failed: [Errno 101] Network is unreachable (<class 'weewx.WeeWxIOError'>)
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** Traceback (most recent call last):
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/drivers/vantage.py", line 342, in openPort
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** self.socket.connect((self.host, self.port))
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** OSError: [Errno 101] Network is unreachable
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: ****
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** During handling of the above exception, another exception occurred:
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: ****
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** Traceback (most recent call last):
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/engine.py", line 119, in setupStation
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** self.console = loader_function(config_dict, self)
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/drivers/vantage.py", line 40, in loader
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** return VantageService(engine, config_dict)
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/drivers/vantage.py", line 1916, in __init__
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** Vantage.__init__(self, **config_dict[DRIVER_NAME])
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/drivers/vantage.py", line 514, in __init__
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** self.port.openPort()
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** File "/usr/share/weewx/weewx/drivers/vantage.py", line 346, in openPort
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** raise weewx.WeeWxIOError(ex)
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL weewx.engine: **** weewx.WeeWxIOError: [Errno 101] Network is unreachable
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL __main__: Unable to load driver: [Errno 101] Network is unreachable
Sep 24 09:29:57 raspi-server-misc weewx[528] CRITICAL __main__: **** Exiting...

Seems like it tried to start up prior to the network stack. Any way to keep this from happening? Or have weewx wait a bit and try again? I noticed something similar a couple weeks ago when I was updating my home network (firmware on Unifi switches) weewx couldn't talk to my Vantage so it gave up and died. Seems like it should go into some "retry" state where it backs off and tries again in like 1-5 minutes automatically. 

Thanks! 

Tom Keffer

unread,
Sep 24, 2022, 1:54:01 PM9/24/22
to weewx...@googlegroups.com
Are you using a systemd script? Or, init? If the former, you could include a network target. Under the [Unit] section, you'd want something like

[Unit]
  ...
  After=network-online.target
  Wants=network-online.target
  ...

Alternatively, if you do not use systemd, you can use the --loop-on-init flag on the weewxd command line. Normally, if a device driver cannot be loaded on startup, weewxd quits, figuring it's a configuration issue. This flag tells it to keep trying.



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/5eaf66b1-6c2d-4007-bdb8-34f9d09ac9een%40googlegroups.com.

Ryan Stasel

unread,
Sep 26, 2022, 11:47:18 AM9/26/22
to weewx-user
Sorry for delay responding, Google groups not auto-subscribing to threads I start myself is... annoying. 

I'm using the default init.d script I believe. Didn't even know there was a systemd option. 

So for init.d I should be able to just add "--loop-on-init" to the "start-stop-daemon" line? 

Or should I just switch to systemd? 

Tom Keffer

unread,
Sep 26, 2022, 5:41:54 PM9/26/22
to weewx...@googlegroups.com
On an RPi running a modern version of Raspbian, I much prefer systemd. Easier to do things like run as a non-root user, and, as you can see, set up dependencies.

See the wiki article How to configure WeeWX to run under systemd if you decide to switch.


Ryan Stasel

unread,
Sep 26, 2022, 6:19:14 PM9/26/22
to weewx-user
Thanks Tom, that was easy enough! Got it flipped over to systemd. 

Will this also, theoretically, handle the situation where station goes offline? Or will weewx die after a few minutes and require manual intervention?

Tom Keffer

unread,
Sep 26, 2022, 6:45:17 PM9/26/22
to weewx...@googlegroups.com
If something happens to the station, weewxd will keep retrying every 60 seconds indefinitely.

Reply all
Reply to author
Forward
0 new messages