WeeWX doesnt run in daemon or startup after reboot - any help?

176 views
Skip to first unread message

Lodewyk Jansen

unread,
Sep 19, 2019, 5:29:02 PM9/19/19
to weewx-user
Hi,

After installing the WeeWX (via python) and following the instruction to run the program in daemon - it doesn't want to start after a reboot. 

1) Any suggestions on what i should change and where? 
2) ....something a bit more off topic - is it possible to ensure that the raspberry pi will not go into sleep mode? (i had the pi powered on and running python (manually) overnight. when i got back and plugged in my screen it stayed blank - the LED light was on (Red). I am just not sure why the screen didn't go on...)

Please bare in mind that my python skills is basic and i am just starting with everything - so i am guessing the fix might be something short and easy. 

Thanks in advance for your replies and help on this. 



gjr80

unread,
Sep 19, 2019, 7:09:10 PM9/19/19
to weewx-user
Hi,

Regards your daemon problem, have you been able to run WeeWX directly? If not then you need to address that first, otherwise the best place to start is by posting the log from when WeeWX attempts to start. Have a look at the Help! Posting to weewx user in the wiki.

Gary

Lodewyk Jansen

unread,
Sep 19, 2019, 7:22:20 PM9/19/19
to weewx-user
Hi Gary,

I can start/stop/restart WeeWX with the following command:
sudo /etc/init.d/weewx start/stop/restart

So no issue with that. 
My goal with this is to take the weather station out to a site and deploy. then when everything is ready i connect (power-up) the raspberry pi to archive all the weather data. I wont have a screen or mouse with me in the field - therefore the automated start of WeeWX is essential. 

Attached is the log file i created. 

Regards,
LJ
mylog

gjr80

unread,
Sep 19, 2019, 7:40:49 PM9/19/19
to weewx-user
OK, so WeeWX runs fine, the issue is purely one of WeeWX not starting after a reboot.

So was that log extract the startup of WeeWX as part of a reboot? I'm guessing not if your problem is that WeeWX does not start after a reboot. What is in the log on reboot?

Might also help to know what instructions you followed, I run WeeWX on a number of RPis and my log looks nothing like that. Setting WeeWX to run as a daemon on boot is as simple as copying a file, changing a file permission and creating a link. When I see something like 'Started Daemon to control my Weewx weather station.' I am wondering if something else has been modified.

Gary

Lodewyk Jansen

unread,
Sep 20, 2019, 12:30:25 AM9/20/19
to weewx-user
Hi Gary,

Yes, WeeWX runs fine -- when I start it manually.

Not sure how I would get the log over a reboot but will look into it now and post the log once I have it. 

I followed the same instructions as detailed in the link you listed and I only opened the file to make sure the ROOT was updated and refer to the correct location. Other than that I did nothing else. 

Regards,

gjr80

unread,
Sep 20, 2019, 8:04:48 PM9/20/19
to weewx-user
OK, still seems to be some unusual output; I have never seen the entry:

Sep 20 11:17:10 raspberrypi systemd[1]: Started Daemon to control my Weewx weather station.

plus WeeWX does not normally log the following, that looks more like the output from running WeeWX directly:

Sep 20 11:17:11 raspberrypi weewxd[1381]: REC:    2019-09-20 11:13:00 NZST (1568934780) altimeter: 1026.86096833, appTemp: 19.0996682438, barometer: 1027.09152857, cloudbase: 1330.70119407, consBatteryVoltage: None, dateTime: 1568934780, dewpoint: 8.93508609165, ET: 0.0, forecastRule: 9, heatindex: 19.3333333333, highOutTemp: 66.9, humidex: 20.1354183953, inDewpoint: 8.32477957838, inHumidity: 46.0, inTemp: 20.3333333333, interval: 1, leafTemp1: -67.2222222222, leafTemp2: -63.3333333333, leafWet1: 1.0, leafWet2: 8.0, lowOutTemp: 66.8, maxSolarRad: 755.506647187, outHumidity: 51.0, outTemp: 19.3333333333, pressure: 1023.02049079, rain: 0.0, rainRate: 0.0, rxCheckPercent: 100.0, soilMoist1: 4.0, soilMoist2: 8.0, soilMoist3: 4.0, soilMoist4: 32.0, soilTemp1: -67.2222222222, soilTemp2: -67.7777777778, soilTemp3: -67.2222222222, soilTemp4: -67.7777777778, txBatteryStatus: None, usUnits: 17, windchill: 19.3333333333, windDir: None, windGust: 0.0, windGustDir: None, windrun: 0.0, windSpeed: 0.0

In terms of a startup log, unless you have changed the logging you should the WeeWX log in /var/log/syslog. After booting the RPi if you look in syslog you should see the whole boot sequence and towards the end you should see an attempt to start WeeWX, something like:

Sep 21 09:47:09 stretch cron[322]: (CRON) INFO (Running @reboot jobs)
Sep 21 09:47:09 stretch systemd[1]: Started OpenBSD Secure Shell server.
Sep 21 09:47:10 stretch systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Sep 21 09:47:10 stretch systemd[1]: Started A high performance web server and a reverse proxy server.
Sep 21 09:47:10 stretch systemd[1]: Started The PHP 7.0 FastCGI Process Manager.
Sep 21 09:47:11 stretch dhclient[305]: bound to 192.168.2.103 -- renewal in 1463 seconds.
Sep 21 09:47:11 stretch sh[291]: bound to 192.168.2.103 -- renewal in 1463 seconds.
Sep 21 09:47:11 stretch mysqld[443]: 2019-09-21  9:47:11 140538782215552 [Note] /usr/sbin/mysqld (mysqld 10.1.37-MariaDB-0+deb9u1) starting as process 443 ...
Sep 21 09:47:11 stretch systemd[1]: Reloading OpenBSD Secure Shell server.
Sep 21 09:47:11 stretch sh[291]: enp0s3=enp0s3
Sep 21 09:47:11 stretch weewx[352]: engine: Initializing weewx version 3.9.2a1
Sep 21 09:47:11 stretch weewx[352]: engine: Using Python 2.7.13 (default, Sep 26 2018, 18:42:22) #012[GCC 6.3.0 20170516]
Sep 21 09:47:11 stretch weewx[352]: engine: Platform Linux-4.9.0-8-amd64-x86_64-with-debian-9.8
Sep 21 09:47:11 stretch weewx[352]: engine: Locale is 'en_AU.UTF-8'
Sep 21 09:47:11 stretch weewx[352]: engine: pid file is /var/run/weewx.pid
Sep 21 09:47:11 stretch weewx[309]: Starting weewx weather system: weewx.
Sep 21 09:47:11 stretch systemd[1]: Started LSB: weewx weather system.
Sep 21 09:47:11 stretch systemd[1]: Reloaded OpenBSD Secure Shell server.
Sep 21 09:47:11 stretch weewx[462]: engine: Using configuration file /home/weewx/weewx.conf
Sep 21 09:47:11 stretch weewx[462]: engine: Loading station type Simulator (weewx.drivers.simulator)
Sep 21 09:47:11 stretch weewx[462]: engine: StdConvert target unit is 0x1
Sep 21 09:47:11 stretch weewx[462]: wxcalculate: The following values will be calculated: barometer=prefer_hardware, windchill=prefer_hardware, dewpoint=prefer_hardware, appTemp=prefer_hardware, rainRate=prefer_hardware, windrun=prefer_hardware, heatindex=prefer_hardware, maxSolarRad=prefer_hardware, humidex=prefer_hardware, pressure=prefer_hardware, inDewpoint=prefer_hardware, ET=prefer_hardware, altimeter=prefer_hardware, cloudbase=prefer_hardware
Sep 21 09:47:11 stretch weewx[462]: wxcalculate: The following algorithms will be used for calculations: altimeter=aaNOAA, maxSolarRad=RS
Sep 21 09:47:11 stretch weewx[462]: engine: Archive will use data binding wx_binding
Sep 21 09:47:11 stretch weewx[462]: engine: Record generation will be attempted in 'hardware'
Sep 21 09:47:11 stretch weewx[462]: engine: Using archive interval of 300 seconds (specified in weewx configuration)
Sep 21 09:47:11 stretch weewx[462]: engine: Using binding 'wx_binding' to database 'weewx.sdb'
Sep 21 09:47:11 stretch weewx[462]: manager: Starting backfill of daily summaries
Sep 21 09:47:11 stretch weewx[462]: restx: StationRegistry: Registration not requested.
Sep 21 09:47:11 stretch weewx[462]: restx: Wunderground: Posting not enabled.
Sep 21 09:47:11 stretch weewx[462]: restx: PWSweather: Posting not enabled.
Sep 21 09:47:11 stretch weewx[462]: restx: CWOP: Posting not enabled.
Sep 21 09:47:11 stretch weewx[462]: restx: WOW: Posting not enabled.
Sep 21 09:47:11 stretch weewx[462]: restx: AWEKAS: Posting not enabled.
Sep 21 09:47:11 stretch weewx[462]: engine: Starting up weewx version 3.9.2a1
Sep 21 09:47:11 stretch weewx[462]: engine: Clock error is -0.27 seconds (positive is fast)
Sep 21 09:47:11 stretch weewx[462]: engine: Starting main packet loop.
Sep 21 09:47:13 stretch systemd[1]: Started MariaDB 10.1.37 database server.
Sep 21 09:47:13 stretch systemd[1]: Reached target Multi-User System.
Sep 21 09:47:13 stretch systemd[1]: Reached target Graphical Interface.
Sep 21 09:47:13 stretch systemd[1]: Starting Update UTMP about System Runlevel Changes...
Sep 21 09:47:13 stretch systemd[1]: Started Update UTMP about System Runlevel Changes.
Sep 21 09:47:13 stretch systemd[1]: Startup finished in 1.739s (kernel) + 7.365s (userspace) = 9.104s.
Sep 21 09:47:39 stretch systemd-timesyncd[233]: Synchronized to time server 130.217.226.50:123 (2.debian.pool.ntp.org).
Sep 21 09:47:39 stretch systemd[1]: Time has been changed
Sep 21 09:47:39 stretch systemd[1]: apt-daily-upgrade.timer: Adding 37min 20.524104s random time.
Sep 21 09:47:39 stretch systemd[1]: apt-daily.timer: Adding 7h 27min 21.620695s random time.
Sep 21 09:50:16 stretch weewx[462]: manager: Added record 2019-09-21 09:50:00 AEST (1569023400) to database 'weewx.sdb'
Sep 21 09:50:16 stretch weewx[462]: manager: Added record 2019-09-21 09:50:00 AEST (1569023400) to daily summary in 'weewx.sdb'
Sep 21 09:50:17 stretch weewx[462]: cheetahgenerator: Generated 8 files for report SeasonsReport in 0.53 seconds
Sep 21 09:50:18 stretch weewx[462]: imagegenerator: Generated 57 images for SeasonsReport in 0.82 seconds
Sep 21 09:50:18 stretch weewx[462]: copygenerator: copied 5 files to /home/weewx/public_html
Sep 21 09:50:18 stretch weewx[462]: copygenerator: copied 6 files to /home/weewx/public_html/ss
Sep 21 09:50:18 stretch weewx[462]: cheetahgenerator: Generated 2 files for report SteelSeries in 0.09 seconds
Sep 21 09:50:18 stretch weewx[462]: imagegenerator: Generated 11 images for SteelSeries in 0.09 seconds

Gary

Lodewyk Jansen

unread,
Sep 30, 2019, 3:30:14 PM9/30/19
to weewx-user
Hi Gary,

Thanks you for the response - attached is the syslog file. 
The weather station was out for the week but it is back again. I restarted it this morning and still no luck with Weewx running by itself. 

Do you think there is something i need to edit in the daemon config file? (found at  /etc/init.d/weewx)
syslog
weewx

gjr80

unread,
Sep 30, 2019, 8:53:14 PM9/30/19
to weewx-user
Thanks. Starting to reach the limits of my expertise but I don't think there is anything wrong with the /etc/init.d/weewx script; rather I think there is some other fundamental problem. The run script is identical to the distributed Debian based version and since you can start and stop WeeWX via /etc/init.d/weewx its permissions are fine. Can you have a look in /etc/rc0.d, /etc/rc1.d, etc up to /etc/rc6.d. Is there a link in each to /etc/init.d/weewx ? The command

$ sudo update-rc.d weewx defaults 98

should have created those links athis is what starts/stops WeeWX during boot and shutdown. /etc/rc0.d, /etc/rc1.d and /etc/rc6.d should have links named K01weewx whereas the others should have links named S01weewx, eg:

etc/rc6.d:
 2929 lrwxrwxrwx   1 root root   15 Jun 12 16:41 K01weewx -> ../init.d/weewx

and

/etc/rc5.d:
 2911 lrwxrwxrwx   1 root root   15 Jun 12 16:41 S01weewx -> ../init.d/weewx

I would also like to understand why WeeWX is starting with the 'Started Daemon to control my Weewx weather station.' message and why the loop packets and archive records are appearing in the log. I know you have provided a log when WeeWX was running but it was only a brief extract plus debug was turned off. Can you edit /home/weewx/weewx.conf, set debug = 1, save weewx.conf and then restart WeeWX. Let WeeWX run for at least three archive periods and then post a log extract showing from just before WeeWX was started through until the three archive periods elapsed.

Gary

Lodewyk Jansen

unread,
Sep 30, 2019, 11:21:26 PM9/30/19
to weewx-user
Hi Gary,

Thanks it seems that there might be an issue with something somewhere but i dont know where. 

All the links in rc0..etc. is created. 
The conf file is updated and the log file is attached. 

Will try to get a system reboot log file also.

Regards


mylog

gjr80

unread,
Oct 1, 2019, 12:06:58 AM10/1/19
to weewx-user
Something is not right. WeeWX was started but then did nothing:

Oct  1 16:02:20 raspberrypi kernel: [  366.572146] rpi_firmware_get_throttled: 4 callbacks suppressed
Oct  1 16:02:20 raspberrypi kernel: [  366.572153] Voltage normalised (0x00000000)
Oct  1 16:02:34 raspberrypi kernel: [  381.133930] Under-voltage detected! (0x00050005)
Oct  1 16:02:38 raspberrypi kernel: [  385.294190] Voltage normalised (0x00000000)
Oct  1 16:02:51 raspberrypi kernel: [  397.774281] Under-voltage detected! (0x00050005)
Oct  1 16:03:01 raspberrypi kernel: [  408.174338] Voltage normalised (0x00000000)
Oct  1 16:03:16 raspberrypi systemd[1]: Stopping LSB: weewx weather system...
Oct  1 16:03:21 raspberrypi systemd[1]: weewx.service: Control process exited, code=exited, status=1/FAILURE
Oct  1 16:03:21 raspberrypi systemd[1]: weewx.service: Failed with result 'exit-code'.
Oct  1 16:03:21 raspberrypi systemd[1]: Stopped LSB: weewx weather system.
Oct  1 16:05:21 raspberrypi systemd[1]: Starting LSB: weewx weather system...
Oct  1 16:05:22 raspberrypi systemd[1]: Started LSB: weewx weather system.

Oct  1 16:06:54 raspberrypi kernel: [  640.936253] usb 1-1.3: USB disconnect, device number 4
Oct  1 16:06:54 raspberrypi thd[353]: Error reading device '/dev/input/event0'
Oct  1 16:06:54 raspberrypi thd[353]: Error reading device '/dev/input/event1'
Oct  1 16:06:54 raspberrypi thd[353]: Error reading device '/dev/input/event2'
Oct  1 16:06:54 raspberrypi thd[353]: Error reading device '/dev/input/event3'
Oct  1 16:06:54 raspberrypi thd[353]: Error reading device '/dev/input/event4'
Oct  1 16:12:02 raspberrypi systemd[1]: Starting Cleanup of Temporary Directories...
Oct  1 16:12:02 raspberrypi systemd[1]: systemd-tmpfiles-clean.service: Succeeded.
Oct  1 16:12:02 raspberrypi systemd[1]: Started Cleanup of Temporary Directories.
Oct  1 16:17:01 raspberrypi CRON[1575]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

There should have been a whole pile of log entries from WeeWX as it started. You might want to see what the following shows (after WeeWX was started/restarted):

$ sudo systemctl status weewx

Might also be taking a step back and running WeeWX directly. This should start WeeWX (not in daemon mode) and display loop packets and archive records to the console. Post the command you entered to start WeeWX as well as the the output you see.

Gary
Reply all
Reply to author
Forward
0 new messages