Page 1 of 2

Problems Starting As A service

Posted: Mon 26 Apr 2021 6:34 am
by The Dalek Hunter
I am running CMX on a Raspberry Pi 4b booting from a USB hard disk.
I installed it by hand rather than using the image.

It has been running perfectly and I was starting it on boot up using @reboot (sleep 30;cd /home/pi/CumulusMX;sudo mono CumulusMX.exe) & as a Cron job.

I decided to try to start it as a service so as per instructions I copied cumulusmx.service to my /etc/systemd/system/ folder and edited it like this

[Unit]
Description=CumulusMX service
Documentation=https://cumuluswiki.org/a/Main_Page
After=network-online.target

[Service]
User=root
Group=root
ExecStart=/usr/bin/mono-service -d:/home/pi/CumulusMX CumulusMX.exe -service
Type=forking
ExecStopPost=/bin/rm /tmp/CumulusMX.exe.lock

[Install]
WantedBy=multi-user.target

If I now issue a sudo a sudo systemctl start cumulusmx, sudo systemctl stop cumulusmx or sudo systemctl status cumulusmx it all works fine.

However if I do a sudo systemctl enable cumulusmx and then reboot CumulusMX never starts and sudo systemctl status cumulusm gives the following error.

Apr 26 07:21:04 CumulusMX-Pi systemd[1]: Starting CumulusMX service...
Apr 26 07:21:05 CumulusMX-Pi systemd[1]: Started CumulusMX service.
Apr 26 07:21:15 CumulusMX-Pi mono[366]: CumulusMX.exe: Object reference not set to an instance of an object.

Any suggestions ?

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 8:08 am
by mcrossley
Please look in the MXdiags log file and see if there is a clue in there.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 9:22 am
by The Dalek Hunter
Ok - when attempting to start as a service here is the last few lines of the MXdiag log - when started via a Cron Job these lines do not appear

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 10:43 am
by freddie
Looks like a DNS problem to me. DNS may not be available to resolve any FQDNs in the MX config at start-up. Sounds like it is available normally, but possibly not just when MX is starting on a reboot. So a timing issue.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 10:45 am
by The Dalek Hunter
So could I put a delay in the startup in CMX and how long should I put in?

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 10:47 am
by freddie
A delay is a good idea. I would suggest experimenting with perhaps 60 seconds, then reducing it until you encounter the original error.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 11:05 am
by The Dalek Hunter
As the start by Cron has a delay of 30 seconds I tried that and it now starts perfectly.
I will leave it at that without any further meddling :)

Many many thanks.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 11:06 am
by mcrossley
Could you post the whole log file please.

I already have a fix for a DNS crash during the start-up ping in the next release, but your ping host is blank so that should not be coming into play, it looks like it is crashing somewhere else.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 11:12 am
by mcrossley
As you are running a WLL, if your have a Pro account I'd recommend that your set the start-up ping to "www.weatherlink.com", that ensures the Davis cloud is reachable before Cumulus attempts to download historic data from it during catch-up. You would want to set a ping escape time to something sensible too, otherwise Cumulus would never start if Davis was unreachable (or MX thought it was).

Though there is that DNS crash issue in the current version, so maybe hold off until the next release. :( :bash:

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 11:19 am
by The Dalek Hunter
As I said above - I have put in a startup delay of 30 seconds under Program settings -> Start-up Delay (secs) and all is now well.

Re: Problems Starting As A service

Posted: Mon 26 Apr 2021 12:09 pm
by mcrossley
I'd still like teh log file though please. The delay is avoiding the issue, I'd like to get it fixed.

Re: Problems Starting As A service

Posted: Fri 30 Apr 2021 10:59 am
by The Dalek Hunter
Sorry

Been away from my computer for a while.

How do I enable Diags when starting as a service ?

Re: Problems Starting As A service

Posted: Fri 30 Apr 2021 11:22 am
by freddie
Stop MX. Search for DebugLogging=0 in your Cumulus.ini file and change the 0 to 1. Then save and restart MX.

Re: Problems Starting As A service

Posted: Fri 30 Apr 2021 12:46 pm
by The Dalek Hunter
DebugLogging=0 not found in Cumulus.ini

Re: Problems Starting As A service

Posted: Fri 30 Apr 2021 12:55 pm
by mcrossley
You will have to add it into the [station] section - with Cumulus Stopped.