WeeWx not starting up automatically, and then not starting correctly on first run.

1,788 views
Skip to first unread message

W7JBG

unread,
Jan 25, 2016, 2:59:32 PM1/25/16
to weewx-user
Setup:
Rasperry Pi 2 B
Weewx 3.3.1 installed with the .deb file 
Ambient Weather WS-1400-IP weather station

I basically got everything setup exactly how I want it, but I'm having no luck getting Weewx to run on startup. 

I've checked the log, and it doesn't attempt to start up. I've gone to the users guide and followed the section to startup as a daemon automatically when the computer starts:


sudo chmod +x /etc/init.d/weewx 
sudo update-rc.d weewx defaults 98 
sudo /etc/init.d/weewx start
I omitted the first part since the file was already there from the .deb installation.   

Upon rebooting, nothing shows up for WeeWx in the log. I use another prompt to watch the log, start Weewx manually, and it'll say starting, but nothing happens (line 10 below this line), and never say anything again until I stop it. But when I start it the next time, it works fine. So far every startup is like this. Below is a few lines, and this is with detailed logging on.

Jan 25 13:11:58 W7JBGWxPi ntpd[822]: Listen normally on 7 eth0 192.168.1.212 UDP 123 
Jan 25 13:11:58 W7JBGWxPi ntpd[822]: peers refreshed 
Jan 25 13:12:13 W7JBGWxPi systemd[496]: Time has been changed 
Jan 25 13:12:13 W7JBGWxPi systemd[1]: Time has been changed 
Jan 25 13:12:14 W7JBGWxPi systemd[1]: Starting Session c5 of user pi. 
Jan 25 13:12:14 W7JBGWxPi systemd[1]: Started Session c5 of user pi.
a
Jan 25 13:13:39 W7JBGWxPi systemd[1]: Starting Session c6 of user pi. 
Jan 25 13:13:39 W7JBGWxPi systemd[1]: Started Session c6 of user pi. 
Jan 25 13:15:13 W7JBGWxPi systemd[1]: Started LSB: weewx weather system. 
Jan 25 13:15:26 W7JBGWxPi systemd[1]: Stopping LSB: weewx weather system... 
Jan 25 13:15:26 W7JBGWxPi weewx[1259]: Stopping weewx weather system: weewx not running.... 
Jan 25 13:15:26 W7JBGWxPi systemd[1]: Stopped LSB: weewx weather system. 
Jan 25 13:15:28 W7JBGWxPi systemd[1]: Starting LSB: weewx weather system... 
Jan 25 13:15:29 W7JBGWxPi weewx[1321]: engine: Initializing weewx version 3.3.1 
Jan 25 13:15:29 W7JBGWxPi weewx[1321]: engine: Using Python 2.7.9 (default, Mar  8 2015, 00:52:26) #012[GCC 4.9.2] 
Jan 25 13:15:29 W7JBGWxPi weewx[1321]: engine: Platform Linux-4.1.13-v7+-armv7l-with-debian-8.0 
Jan 25 13:15:29 W7JBGWxPi weewx[1321]: engine: pid file is /var/run/weewx.pid 
Jan 25 13:15:29 W7JBGWxPi weewx[1311]: Starting weewx weather system: weewx. 
Jan 25 13:15:29 W7JBGWxPi systemd[1]: Started LSB: weewx weather system. 
Jan 25 13:15:29 W7JBGWxPi weewx[1325]: engine: Using configuration file /etc/weewx/weewx.conf 
Jan 25 13:15:29 W7JBGWxPi weewx[1325]: engine: Initializing engine 
Jan 25 13:15:29 W7JBGWxPi weewx[1325]: engine: Loading station type ObserverIP (user.observerip) 
Jan 25 13:15:29 W7JBGWxPi weewx[1325]: observerip: version is 0.5mw 
Jan 25 13:15:35 W7JBGWxPi weewx[1325]: observerip: Unknown firmware version: ▒▒▒▒▒▒▒▒▒#001#007USA_v3.0.7.bin 
Jan 25 13:15:35 W7JBGWxPi weewx[1325]: observerip: polling interval is 16.0
Jan 25 13:15:36 W7JBGWxPi weewx[1325]: engine: Loading service weewx.engine.StdTimeSynch
 Jan 25 13:15:36 W7JBGWxPi weewx[1325]: engine: Finished loading service weewx.engine.StdTimeSynch 
Jan 25 13:15:36 W7JBGWxPi rsyslogd-2007: action 'action 17' suspended, next retry is Mon Jan 25 13:16:06 2016 [try http://www.rsyslog.com/e/2007 ]

I can provide more log details if needed. Any solutions or ideas for this?

vince

unread,
Jan 25, 2016, 3:51:55 PM1/25/16
to weewx-user
On Monday, January 25, 2016 at 11:59:32 AM UTC-8, W7JBG wrote:
Setup:
Rasperry Pi 2 B
Weewx 3.3.1 installed with the .deb file 
Ambient Weather WS-1400-IP weather station

I basically got everything setup exactly how I want it, but I'm having no luck getting Weewx to run on startup. 



Which version of debian are you running ?
That should be in /etc/debian_release or something close to that name.
Is it 8.something ?

W7JBG

unread,
Jan 25, 2016, 3:58:03 PM1/25/16
to weewx-user
8.0


And one minor addition; if upon the first boot of the Pi I tell it to first stop Weewx, then start, it works. 

But the before mentioned "start" doesn't work when it's the first thing done, only after "start" "stop" "start".

Jafar Al-Gharaibeh

unread,
Jan 25, 2016, 4:21:44 PM1/25/16
to weewx-user
The log seems OK. Are  you connecting the RPi to a network over WiFi/Ethernet?  not sure if weewx module depends on something that is not ready by that time it runs during startup. Try to change the dependencies in the init script so that weex starts at the end. On My RPi, I have the following block in /etc/init.d/weeex:

### BEGIN INIT INFO
# Provides:          weewx
# Required-Start:    $local_fs $remote_fs $syslog $ntp
# Required-Stop:     $local_fs $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: weewx weather system
# Description:       Manages the weewx weather system
### END INIT INFO

You can add $all at the end of the line of # Required-Start, so it becomes:
# Required-Start:    $local_fs $remote_fs $syslog $ntp $all

Give that a try.

Regards,



vince

unread,
Jan 25, 2016, 4:29:15 PM1/25/16
to weewx-user
FWIW, my debian and ubuntu vagrant boxes start up just fine, but I tend to use the setup.py method usually.   There was a dependency in there re: ntp needing to be up first, and I think current weewx enforces sensible time as a prerequisite a little more strongly than 3.3.x did, if I remember correctly.

If you don't have any reason to stick with the older version you 'might' want to consider getting current as part of this issue, especially since your system seems to work ok (other than the startup at boot problem of course).

W7JBG

unread,
Jan 25, 2016, 9:41:24 PM1/25/16
to weewx-user
It's over ethernet, and I made that change you listed, saved the file, and rebooted. Still the same result.

And just to reiterate what's going on since my first post lacked it:

Upon startup Weewx doesn't run automatically. 
If I start weewx, it won't run. 
If I stop weewx, then start, it'll run.
If I start weewx, stop it since it's not working, and then start, it'll work the second time it's started. 

Basically I have to stop it first, even though according to the system log it's not even running on boot. 

W7JBG

unread,
Jan 25, 2016, 10:33:47 PM1/25/16
to weewx-user
The distro I put on the Pi was the latest listed on the raspberry pi for Jessie (Nov-15-2015).
I did notice some issue a little while back, when I unplugged the Pi for a while, the time would continue from where it left off unupdated. I think I used ntpdate to solve this problem and update the clock each time it starts. But that shouldn't be an issue now since I've moved the Pi to it's permanent location, and it's on a battery backup by itself. 

vince

unread,
Jan 26, 2016, 2:11:00 PM1/26/16
to weewx-user
You're not quite providing sufficient data to let us get you working.   The pi runs a thing called 'fake hwclock' to periodically save the date+time to a file.  If you cycle power on the box, it will use that last known value to initialize time semi-close to reality.   Many people disable that and run ntpd which is a far preferred solution if you have not added a RTC module to your Pi.  There are dozens of previous threads in the weewx newsgroup related to clock issues on systems like the Pi with no RTC.  Far too many to summarize here.

Where I'm a little confused is the 'not starting until you stop it' part as I thought we had that solved a long time ago.

On my debian 8 systems, I used the setup.py method to install, and use the systemctl method to do the service enabling and startup.

vagrant@debian-jessie:~$ cat /etc/debian_version
8.2

vagrant@debian-jessie:~$ systemctl list-unit-files | grep weewx
weewx.service                          enabled
 
vagrant@debian-jessie:~$ systemctl | grep weewx
weewx.service                                                                            loaded active running   weewx weather system


 You might (might) be finding a flaw in the old .deb you are using, but I'm not certain.  Again getting to a new version gets you the best chance of being supportable.

If you wanted to take a crack at the setup.py method, I have that all automated for Vagrant if you look at my github repo vinceskahan/weewx-vagrant-debian8.git and specifically the provision.sh script.  That has all the steps to take a clean debian8 system (ie, modern Raspbian too) and install weewx in simulator mode and have it work first time every time using setup.py installation.  

You'd of course want to set up your weewx.conf file appropriately for your site.  Also recommend setting debug=1 in weewx.conf for sure.


W7JBG

unread,
Feb 8, 2016, 8:04:28 PM2/8/16
to weewx-user
I decided to start all over again, and wipe everything to fix this problem; that and I had installed a few things like camera software that I couldn't get working, and thought that wiping the whole card was the easiest way to just clean everything up and hopefully solve the problem.  

I'll check out what you posted. You say the "old .deb" I'm using; do you mean the install file, or the OS? Before I did anything on the Pi, I did an apt-get update && apt-get upgrade && apt-get dist-upgrade (I think upgrade, it was that or upgrade).

I'm still getting the same issue on startup; it's basically remedied to the point where I don't care since the Pi is on an APC battery backup by itself, which should last at least a day because of it's power usage. And since I don't think I've had a power outage for more than two hours in at least a decade, if not two, that's no problem. I've also left the time stuff unchanged, just updating the clock manually if it's ever wrong. 

I've already got the .conf files backed up, as well as the databases, and basically any files it uses. Though I didn't reuse them completely, I just used it for a side by side comparison for all my settings to make sure I didn't forget anything major. 


vince

unread,
Feb 8, 2016, 8:28:11 PM2/8/16
to weewx-user
You said you're using weewx 3.3.1 which is dated.  Use the current one whenever you can do so, it is (hopefully) more bug-free.   There are checks in the current weewx to try to deal with obviously bad system time.

Re: the clock, just install and run ntpd if you're not using a RTC.


Albert Mantel

unread,
Feb 13, 2016, 9:15:57 AM2/13/16
to weewx-user
I have the same problem.
Running even after an upgrade to V3.4.0 I keep the problem.
I am running Weewx on Ubuntu 12.04 with the latest upgrades and with vantage weatherstation see http://www.montjoie.eu/master.html
I have the problem that after a reboot Weewx is not always starting always and I have to start it manualy.This is difficult while I have not an always connected console.  Sometimes it's running for a week mostly it crashes after 30 -90 days. I don't know why.
Most of the time after crash the webserver is still running but the web, Wunderground AND MYSQL are no longer updated.
There is nothing strange in the logfiles.

Thomas Keffer

unread,
Feb 13, 2016, 9:41:47 AM2/13/16
to weewx-user
Albert,

1. I know you may think there is nothing strange in the logfiles, but they are the only clues we have to work with. Please include them, preferably with debug=1.

2. It sounds like you have two problems: 

  a. Weewx crashes after 30-90 days. What do you mean by this? The program exits? Or, it is still running, but does not update the web, Wunderground, and MySQL?
  b. It does not always restart

Is this correct? If so, make sure you include logs for both events.

-tk

--
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.
For more options, visit https://groups.google.com/d/optout.

Ab Mantel

unread,
Feb 13, 2016, 11:02:52 AM2/13/16
to weewx...@googlegroups.com
Thomas,
I have added 2 logfiles created today.
One with after a reboot while weewx was not starting and one with a reboot while weewx was starting after a wait of 2 minutes (marked up) wait for mysql.
I have tried the remedy as you suggested on 5/7/2014 to add
$mysql at the end in the # requierd-start line in the /etc/init.d/weewx script but that solved not the issue and I have removed it.

I will tomorrow check the debug=1 and will send you a log file after a crash.

Regards
Albert
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ayOGoCOySx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--

Thomas Keffer

unread,
Feb 13, 2016, 11:11:41 AM2/13/16
to weewx-user
? Nothing was attached ?

-tk

Ab Mantel

unread,
Feb 13, 2016, 11:29:33 AM2/13/16
to weewx...@googlegroups.com
My mistake, to quick with sending.
syslog13-02-2016-not-started-.rtf
syslog13-02-2016-start-with delay.rtf

Thomas Keffer

unread,
Feb 13, 2016, 2:14:51 PM2/13/16
to weewx-user
There is very definitely something of interest in the log files, namely the line,

Feb 13 16:07:02 trimslice weewx[1872]: engine: Unable to load driver: [Errno 11] Resource temporarily unavailable


Unless you actually have a modem, try removing modemmanager

sudo apt-get remove modemmanager

It's looking for a modem at /dev/ttyUSB0 and competing with weewx. Eventually it gives up and relinquishes the port, but not until after weewx exits.

Generally, I/O errors do not crash weewx. The exception is on initial weewx startup, on the assumption that there must be a configuration problem. If you don't like that behavior, or if you really do have a modem that could potentially be on that port, then run the daemon with the option --loop-on-init and it will loop forever, waiting for the port to be released.

As for the other log, as you guessed, the problem is that MySQL is not starting early enough. Frankly, I am not an expert on how upstart works (the init system for Ubuntu 12.04), so I can't really help you there. Perhaps someone else knows how to solve this problem? In any case, weewx eventually recovers and soldiers on.

Finally, if you get an example of  a weewx "crash" after 30-90 days. be sure to post it.

-tk

P Simmons

unread,
Feb 13, 2016, 4:20:46 PM2/13/16
to weewx-user


On Saturday, February 13, 2016 at 1:14:51 PM UTC-6, Tom Keffer wrote:
There is very definitely something of interest in the log files, namely the line,

Feb 13 16:07:02 trimslice weewx[1872]: engine: Unable to load driver: [Errno 11] Resource temporarily unavailable


Unless you actually have a modem, try removing modemmanager

sudo apt-get remove modemmanager

It's looking for a modem at /dev/ttyUSB0 and competing with weewx. Eventually it gives up and relinquishes the port, but not until after weewx exits.



Hey there, Tom... if there's a udev rule for the USB device, one can add ENV{ID_MM_DEVICE_IGNORE}="1" to the rule, and modemmanager will leave it alone.

Best,
Paul

Thomas Keffer

unread,
Feb 13, 2016, 4:40:34 PM2/13/16
to weewx-user
Yes, that's true, but it's easier to teach a user how to nuke modemmanager than to mess with UDEV rules.

But, hey, do you know anything about upstart?

-tk

--

P Simmons

unread,
Feb 14, 2016, 1:24:10 AM2/14/16
to weewx-user


On Saturday, February 13, 2016 at 3:40:34 PM UTC-6, Tom Keffer wrote:
Yes, that's true, but it's easier to teach a user how to nuke modemmanager than to mess with UDEV rules.

But, hey, do you know anything about upstart?

-tk




I agree that UDEV rules might be a bit much of a stretch for non- *nix folk.  Uninstalling modemmanager is a simpler solution.

Thanks for reminding me of upstart - I really need to investigate other init systems.  Historically (hysterically?), I've used SysV and BSD systems, and am wary of (but surviving) systemd (on Fedora). I dislike binary system files, and want to be able to make changes with a CLI text editor (ed, sed, vi).  I was taught Keep It Super Simple principles in the '70s and '80s.

p.

Jon Adams

unread,
Nov 25, 2016, 10:01:55 AM11/25/16
to weewx-user
I know this thread has been dormant for some time, and I don't see that a solution has been determined, but I've got the same problem with my weewx install on an RPi3, and it's been a bit frustrating. 

The RPi is on battery backup, so glitches in AC don't impact it, but still, when for some reason I have to reboot it, I have to start the weewx service, then stop it, then restart it before it will actually launch successfully. My other programs queued to autostart seem to behave alright, the webserver and ftp server come up fine.

Setup is RPi3 running Debian 8.0, uname shows: Linux raspberrypi 4.4.21-v7+ #911 SMP Thu Sep 15 14:22:38 BST 2016 armv7l GNU/Linux
Uses a Pi drive (rotating) to prevent early demise of the NVRAM.
Davis VantagePro2 wired with IP connection.
Running weewx 3.5.0

At least on my build, there is no modemmanager,

Similar to W7JBG's situation, after boot up, there's no python or weewx in top or ps aux | grep ---

Again, after boot up, I can issue a 
sudo /etc/init.d/weewx start 
and there's no record of it in the running processes.
if I then issue a
sudo /etc/init.d/weewx stop

there's no delay in the prompt returning.
Then, i issue
sudo /etc/init.d/weewx start 

and this time both python and weewx are found as one of the running processes.

Has this been resolved?

Cheers and 73 - Jon N7UV

Andrew Milner

unread,
Nov 25, 2016, 10:18:07 AM11/25/16
to weewx-user
what does the log say during this boot / stop / start procedure??

Jon Adams

unread,
Nov 25, 2016, 2:53:34 PM11/25/16
to weewx-user
I've attached the syslog. All times are local (MST)

083500: Pi powered on
083525: the syslog starts getting written to.
083525 (row 406): systemd starts weewx
083529 (row 521): Initializing weewx version 3.5.0
083529 (row 544): weewx can't find wired VantagePro on 192.168.1.45
083529 (row 547): weewx exits because it can't find a network (but there was a network already set up?)
083709 (row 645): I log in from SSH. I check top and ls aux | grep weewx and python and find neither.
083903 (row 648): I start weewx from CLI, nothing happens.
083952 (row 651): from CLI, I start weewx again. Nothing happens on top or ps aux
084352 (row 656): from CLI, i stop weewx.
084357 (row 659): from CLI, i start weewx. This time it takes.
syslog1.txt
Message has been deleted

mwall

unread,
Nov 25, 2016, 3:14:35 PM11/25/16
to weewx-user


On Friday, November 25, 2016 at 2:53:34 PM UTC-5, Jon Adams wrote:
083529 (row 547): weewx exits because it can't find a network (but there was a network already set up?)

jon,

your configuration requires a network connection to the vantage station, and weewx is bailing out when it finds no network (see lines 546 and 547 of the syslog you posted).

by the time you try to start weewx directly, then network is functional.

you need to tell systemd that weewx needs a fully functional network before it is started up.

or you can add the loop-on-init option to your weewx configuration file:

loop_on_init = True

that will make weewx keep retrying the startup process instead of exitting.

m

vk3...@gmail.com

unread,
Nov 27, 2016, 9:52:24 PM11/27/16
to weewx-user
I had the same problem. A bit of research shows that I needed to edit the /etc/init.d/weewx file so that the 

# Required-Start: 

line contains '$network'.

This is converted by the tools that translate the SysVInit code to 'systemd' code to wait until the network is operational.

Susan

Jon Adams

unread,
Dec 2, 2016, 10:55:27 AM12/2/16
to weewx-user
Good day, Susan -

Thanks for the response. I tried this but it doesn't seem to solve my situation. When I do a reboot of the RPi, this is what happens:

1) reboot pi
2) wait (I wait several minutes, just in case) for pi to come up and load weewx, pureftpd, lighttpd, ntpd
3) surf in via web browser to weewx web page via lighttpd. get webpage (network is up and running) but stale data.
4) check pureftpd. works fine. Network is running.
5) start network ssh via PuTTY to Pi. Log in. Everything looks good, but there's no Python or weewx processes running.
6) Issue a start weewx command. Command line returns *immediately*, no errors thrown. Check ps, no python or weewx running.
7) issue a stop weewx command. Command line returns *immediately*, no errors thrown.
8) issue a start weewx command. Command line hesitates maybe a second, no errors thrown. Check ps, both python and weewx are there. Web page updates with current info.
9) issue a stop weewx command. Command line hesitates several seconds, no errors thrown. Check ps, both python and weewx are gone.
10) start weewx again. Everything is up.

I've tried skipping 6), but 6) seems necessary. The network is obviously up and running if pureftpd, ssh, lightpd are all running. It appears to require the start/stop/start to get going.I do not have console access, so I can only access this via network.

I will look at this more soon and try to post more logs. Got to get back to the day job right now.

Thanks again for the assistance.

Cheers - Jon

Andrew Milner

unread,
Dec 2, 2016, 11:05:21 AM12/2/16
to weewx-user
Posting the log to go with your actions is always better than just detailing the actions, so that we can relate the actions taken with what the system was doing /or waiting for at the time the action was taken.

Jon Adams

unread,
Dec 2, 2016, 11:19:11 AM12/2/16
to weewx...@googlegroups.com
understood. Just wanted to acknowledge that I wasn't ignoring.

Sincerely, Jon

Jon Adams, PE, MSEE
Senior Member, IEEE
+1 480.628.6686

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/ayOGoCOySx0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.

vk3...@gmail.com

unread,
Dec 4, 2016, 9:58:45 PM12/4/16
to weewx-user
Thanks for the response. I tried this but it doesn't seem to solve my situation. When I do a reboot of the RPi, this is what happens:

I just looked further back in this thread to see what OS you are running . I see you are running Debian 8.0 ( take it that is 'Jessie') and I'm running the latest Rasbian which should be derived from Jessie.
I was wondering if you were using SysV or systemd. I *think* the reference I made to $network requires systemd so that it will be auto-translated into the correct dependency in the systemd equivalent to the 'init.d' file.

Susan

Andrew Milner

unread,
Dec 4, 2016, 10:26:17 PM12/4/16
to weewx-user
Do you have a RTC on the RPi - or does it possibly get hung up on the initial boot and start-up sequence whilst waiting for NTP to be loaded and setting the correct time?  Subsequant stops and starts are then being made with NTP up, running, and time set.  Just a thought ....
Reply all
Reply to author
Forward
0 new messages