WeeWX v4.8.0 not starting with new systemd.service file on opensuse Leap 15.3

146 views
Skip to first unread message

Bernhard R.

unread,
Apr 22, 2022, 6:44:31 PM4/22/22
to weewx-development
Hi guys,
First of all: Thank you guys for your great work, weewx does a very decent job here for more than 2 years already.

Since the last update however weewx won't start anymore (using systemd). I'm on opensuse Leap 15.3, the update to weewx v.4.8.0 also brought a new service file to /etc/systemd/system/weewx.service
With this new service-file, weewx will not start.
If I put the old service file from 4.7.0 back in place, weewx 4.8.0 starts fine.

Here is, what my log shows, when using the new service file:


Apr 23 00:17:17 nas systemd[1]: Started weewx weather system.
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Initializing weewx version 4.8.0
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Using Python 3.6.15 (default, Sep 23 2021, 15:41:43) [GCC]
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Platform Linux-5.3.18-150300.59.63-default-x86_64-with-glibc2.3.4
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Locale is 'LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C'
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Using configuration file /etc/weewx/weewx.conf
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: Debug is 0
Apr 23 00:17:17 nas python3[4841]: weewx[4841] INFO __main__: PID file is /var/run/weewx.pid
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO weewx.engine: Loading station type WH4000SE (user.WH4000SE)
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO user.WH4000SE: WH4000SE Starting
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO user.WH4000SE: Using user-defined station IP - 192.168.0.41
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO weewx.engine: StdConvert target unit is 0x11
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO weewx.wxservices: StdWXCalculate will use data binding wx_binding
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO __main__: Received signal TERM (15).
Apr 23 00:17:17 nas python3[4849]: weewx[4849] INFO __main__: Terminating weewx version 4.8.0
Apr 23 00:17:17 nas systemd[1]: weewx.service: Succeeded.


Guess that's something to do with this one:
Do not fork if using systemd. PR #767.

Anything I can provide to trace this one?


Tom Keffer

unread,
Apr 22, 2022, 7:46:04 PM4/22/22
to Bernhard R., weewx-development
I was able to reproduce this on a VM running Leap 15.1. I'm not sure exactly what's going on (and I am by no means an expert!), but I think the problem may be the presence of a --daemon flag in the systemd service file. How it got in there, I don't have a clue.

To fix, stop weewx

sudo systemctl stop weewx

Then go into /etc/systemd/system/weewx.service and change this

ExecStart=/usr/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

to this

ExecStart=/usr/bin/weewxd --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

Then reload systemd, and restart weewx:

sudo systemctl daemon-reload
sudo systemctl start weewx

Let me know what happens.

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/5e234c55-56a5-41a2-949a-2ad3038c82d6n%40googlegroups.com.

Bernhard R.

unread,
Apr 23, 2022, 12:54:08 AM4/23/22
to weewx-development
Hi Tom,

thank you for your quick reply!
You are right, your suggeted fix solves the problem and weewx ist starting up as usual now.

May I add one more comment on this?
At least in the suse-world, it seems that pidfiles are to be created in /run now, not in /var/run anymore, following FHS 3.0.
I'm not sure how other distros do handle that but at least for suse, it would be great to alter the ExecStart line to

ExecStart=/usr/bin/weewxd --pidfile=/run/weewx.pid /etc/weewx/weewx.conf

However, this is just a minor thing, weewx starts just fine in both cases, so if this leads to trouble in other distros, we might be better of leaving /var/run in there...

Thanks again for your quick help, have a nice weekend,

Bernhard :-)

matthew wall

unread,
Apr 23, 2022, 1:12:20 AM4/23/22
to weewx-development
On Saturday, April 23, 2022 at 12:54:08 AM UTC-4 Bernhard R. wrote:
May I add one more comment on this?
At least in the suse-world, it seems that pidfiles are to be created in /run now, not in /var/run anymore, following FHS 3.0.
I'm not sure how other distros do handle that but at least for suse, it would be great to alter the ExecStart line to

ExecStart=/usr/bin/weewxd --pidfile=/run/weewx.pid /etc/weewx/weewx.conf

thank you bernhard. the --daemon option has been removed from the systemd unit file at commit 8e13bad1b1e8226569d0685724ac5a4bcbfa1945

i also removed the pidfile option, since the pidfile is not necessary for systemd, and it just causes problems, either in the location (/run vs /var/run) or with permissions (when running as non-root users, you must specify permissions on the directory in which the pid file is located).

these changes should appear in weewx 4.8.1

for the record, the --daemon option works in the unit file when you tell systemd that weewx is a forking process.  but when weewx is declared as a simple non-forking process, using the --daemon option causes problems.  for systems that do not use systemd, the --daemon option is still the preferred invocation.

Bernhard R.

unread,
Apr 23, 2022, 1:21:26 AM4/23/22
to weewx-development
Hi matthew,

confirmed, removing the pidfile option seems not to be doing any harm.
As weewx is now started by systemd in non-forking mode, it does know the pidfile directly from the foreground process (python) anyway, so I would no expect any downsides of removing the pidfile-option in this case...

Thanks again, guys,

Bernhard :-)

Cameron D

unread,
Apr 24, 2022, 4:56:21 AM4/24/22
to weewx-development
I have just implemented this in my systemd service file and notice a journal full of LOOP packets.
Is that why we also need the line saying...
StandardOutput=null

bell...@gmail.com

unread,
Apr 24, 2022, 7:04:06 AM4/24/22
to weewx-development
Yes, that option stops the LOOP and ARCHIVE messages from being logged.
rich

Tom Keffer

unread,
Apr 24, 2022, 7:15:28 AM4/24/22
to Cameron D, weewx-development
As Rich mentions, yes, you need the StandardOutput line, but I'm wondering why it was missing --- it appears in my tests. Can you give us the particulars?

- What operating system?
- Is this a reinstall, or a new install? 
- If a reinstall, is this a new systemd file, or the old one?

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.

Cameron D

unread,
Apr 24, 2022, 10:04:21 PM4/24/22
to weewx-development
I've been running systemd for  some years, so it's my own custom unit file.  I was just adjusting mine to be somewhat closer to the installed version.

I did a clean apt install of weewx  in a debian 11 vm and there was no sign of any systemd unit file for weewx, other than the one based on the sysV init file.  What makes an installation decide to install a systemd unit file?

Tom Keffer

unread,
Apr 24, 2022, 10:17:05 PM4/24/22
to Cameron D, weewx-development
OK, that makes me feel better.

According to Matthew, "The deb packages still use an init script, since it must work on debian-based systems with or without systemd."

Reply all
Reply to author
Forward
0 new messages