Hi
Been trying to get Weewx running on Ubuntu 19.10 but problems...
This how it looks (directly after weewx is started).
m@ubuntu1910n:~$ sudo systemctl status weewx
● weewx.service - weewx weather system
Loaded: loaded (/etc/systemd/system/weewx.service; enabled; vendor preset: en
Active: deactivating (stop-sigterm) since Tue 2020-01-14 00:08:18 CET; 1s ago
Process: 10656 ExecStart=/home/weewx/bin/weewxd --daemon --pidfile=/var/run/we
Main PID: 10656 (code=exited, status=0/SUCCESS)
Tasks: 1 (limit: 1435)
Memory: 8.7M
CGroup: /system.slice/weewx.service
└─10670 /usr/bin/python3 /home/weewx/bin/weewxd --daemon --pidfile=/v
jan 14 00:08:18 ubuntu1910n weewxd[10656]: weewx[10656] INFO weewx.engine: Using
[GCC 9.2.1 20191008]
jan 14 00:08:18 ubuntu1910n weewxd[10656]: weewx[10656] INFO weewx.engine: Platf
jan 14 00:08:18 ubuntu1910n weewxd[10656]: weewx[10656] INFO weewx.engine: Local:
Jan 14 00:08:18 ubuntu1910n systemd[1]: Started weewx weather system.
Jan 14 00:08:18 ubuntu1910n weewx[10656] INFO weewx.engine: Initializing weewx version 4.0.0b8
Jan 14 00:08:18 ubuntu1910n weewx[10656] INFO weewx.engine: Using Python 3.7.5 (default, Nov 20 2019, 09:21:52) #012[GCC 9.2.1 20191008]
Jan 14 00:08:18 ubuntu1910n weewx[10656] INFO weewx.engine: Platform Linux-5.3.0-26-generic-x86_64-with-Ubuntu-19.10-eoan
Jan 14 00:08:18 ubuntu1910n weewx[10656] INFO weewx.engine: Locale is 'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=nl_NL.UTF-8;LC_TIME=nl_NL.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=nl_NL.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=nl_NL.UTF-8;LC_NAME=nl_NL.UTF-8;LC_ADDRESS=nl_NL.UTF-8;LC_TELEPHONE=nl_NL.UTF-8;LC_MEASUREMENT=nl_NL.UTF-8;LC_IDENTIFICATION=nl_NL.UTF-8'
Jan 14 00:08:18 ubuntu1910n weewx[10656] INFO weewx.engine: PID file is /var/run/weewx.pid
Jan 14 00:08:18 ubuntu1910n weewx[10670] INFO weewx.engine: Using configuration file /home/weewx/weewx.conf
Jan 14 00:08:18 ubuntu1910n weewx[10670] DEBUG weewx.engine: Debug is 1
Jan 14 00:08:18 ubuntu1910n weewx[10670] DEBUG weewx.engine: Initializing engine
Jan 14 00:08:18 ubuntu1910n weewx[10670] INFO weewx.engine: Loading station type Vantage (weewx.drivers.vantage)
...
Weewx is running (that seems ok). But then...
...
Jan 14 00:08:29 ubuntu1910n weewx[10670] INFO weewx.engine: Using binding 'wx_binding' to database 'weewx'
Jan 14 00:08:29 ubuntu1910n weewx[10670] INFO weewx.manager: Starting backfill of daily summaries
Jan 14 00:08:29 ubuntu1910n weewx[10670] DEBUG weewx.drivers.vantage: Getting archive packets since 2020-01-14 00:00:00 CET (1578956400)
Jan 14 00:08:30 ubuntu1910n weewx[10670] DEBUG weewx.drivers.vantage: Gentle wake up of console successful
Jan 14 00:08:31 ubuntu1910n weewx[10670] DEBUG weewx.drivers.vantage: Retrieving 0 page(s); starting index= 0
Jan 14 00:08:31 ubuntu1910n weewx[10670] INFO weewx.engine: Starting main packet loop.
Jan 14 00:08:32 ubuntu1910n weewx[10670] DEBUG weewx.drivers.vantage: Gentle wake up of console successful
Jan 14 00:08:33 ubuntu1910n weewx[10670] DEBUG weewx.drivers.vantage: Requesting 200 LOOP packets.
Jan 14 00:08:33 ubuntu1910n weewx[10670] INFO weewx.engine: Received signal TERM (15).
Jan 14 00:08:33 ubuntu1910n weewx[10670] INFO weewx.engine: Main loop exiting. Shutting engine down.
Jan 14 00:08:33 ubuntu1910n weewx[10670] DEBUG weewx.restx: Shut down WOW thread.
Jan 14 00:08:33 ubuntu1910n weewx[10670] DEBUG weewx.restx: Shut down Wunderground-PWS thread.
Jan 14 00:08:33 ubuntu1910n weewx[10670] DEBUG weewx.restx: Shut down StationRegistry thread.
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: Terminating weewx version 4.0.0b8
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** Traceback (most recent call last):
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/engine.py", line 903, in main
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** engine.run()
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/engine.py", line 194, in run
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** for packet in self.console.genLoopPackets():
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/drivers/vantage.py", line 534, in genLoopPackets
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** for _loop_packet in self.genDavisLoopPackets(200):
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/drivers/vantage.py", line 554, in genDavisLoopPackets
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** self.port.wakeup_console(self.max_tries)
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/drivers/vantage.py", line 96, in wakeup_console
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** self.write(b'\n')
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/drivers/vantage.py", line 422, in write
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** time.sleep(self.tcp_send_delay)
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** File "/home/weewx/bin/weewx/engine.py", line 823, in sigTERMhandler
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** raise Terminate
Jan 14 00:08:34 ubuntu1910n weewx[10670] INFO weewx.engine: **** weewx.engine.Terminate
Jan 14 00:08:34 ubuntu1910n systemd[1]: weewx.service: Succeeded.
Seems we are using the wrong startup type in the unit configuration file for the systemd. We should be using forking.
https://www.freedesktop.org/software/systemd/man/systemd.service.html
"If set to simple, the service manager will consider the unit started immediately after the main service process has been forked off. It is expected that the process configured with ExecStart= is the main process of the service."
"If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up. The child continues to run as the main service process, and the service manager will consider the unit started when the parent process exits."
weewx.service (in /etc/systemd/system)
# systemd configuration for weewx
[Unit]
Description=weewx weather system
Requires=time-sync.target
After=time-sync.target
RequiresMountsFor=/home
[Service]
#ExecStart=/home/weewx/bin/weewxd --daemon --pidfile=/var/run/weewx.pid /home/weewx/weewx.conf
ExecStart=/home/weewx/bin/weewxd --daemon --pidfile=/run/weewx.pid /home/weewx/weewx.conf
ExecReload=/bin/kill -HUP $MAINPID
#Type=simple
Type=forking
#PIDFile=/var/run/weewx.pid
PIDFile=/run/weewx.pid
#User=weewx
#Group=weewx
[Install]
WantedBy=multi-user.target
About the PIDFile path: "The path specified typically points to a file below /run/." This behouvior is changed since systemd 240. A warning is issued otherwise:
"Line references path below legacy directory /var/run/, updating /var/run/weewx.pid → /run/weewx.pid; please update the unit file accordingly."
Ubuntu 19.10 then works fine (also Debian10 Buster and Ubuntu 19.04).