MX on Linux: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
2,329 bytes added ,  21:15, 23 July 2021
m
(10 intermediate revisions by the same user not shown)
Line 169: Line 169:
== Preparing for an install==
== Preparing for an install==


Before we do an install of a new package, we typically use some of these commands to ensure our computer is in the best state to work out dependencies of what we are about to install:
Before we do an install of a new package, we typically use this series of commands to ensure our computer is in the best state to work out dependencies of what we are about to install:
<code>
<code>
sudo apt update
sudo apt update
Line 175: Line 175:
sudo apt autoremove
sudo apt autoremove
</code>
</code>
Each of those can be understood from information in previous section.


Each of these can be understood from information in previous section.
If you are installing onto a Pi zero, or similar slow computer, please ensure the size of the swapfile is as big as possible, as the mono-complete we will install is large. In linux, we type <code>free -m</code> to see our RAM size and our swapfile size.


To change swapfile size on the Raspberry Pi, you need to edit a file <code>sudo nano /etc/dphys-swapfile</code>.  Move the cursor down line by line until it reaches '''CONF_SWAPSIZE=100'''.  That is showing that the swapfile is only 99 mb by default in the Raspberry Pi Operating System. Now move the cursor to the 100, and change it to "512" which is enough for mono even on a Pi zero. Next, stop, and restart the relevant service using <code>sudo /etc/init.d/dphys-swapfile stop && sudo /etc/init.d/dphys-swapfile start</code>. That should complete quickly, and we can type <code>free -m</code> again to see the 99 we saw previously has been replaced by 511.
=== USB HID ===
There is one more prerequisite package for MX with some weather station types.
The cross-platform [https://www.nuget.org/packages/HidSharp/ Universal Serial Bus (USB) Human Interface Device (HID) library] used by MX to connect to weather stations that appear as a HID connecting via USB (like Fine Offset and USB connected Oregon Scientific models) calls a package file called ''libudev.so.1'', so you may need to [[#install|search]] your Linux computer for this file, and [[#install]] it if it is missing. Alternatively, you might just need a symbolic link where MX looks to where the file is.
To check your USB devices, type <code>sudo lsusb -t</code). 
To check HID, download this [https://cumulus.hosiene.co.uk/download/file.php?id=11414 USB HID test package] and run it.
Optionally read about [https://cumulus.hosiene.co.uk/viewtopic.php?f=39&t=14310&p=111593&hilit=libudev.so.1#p111593 Oregon Scientific] issues.
To read about [https://cumulus.hosiene.co.uk/viewtopic.php?p=107913#p107913 Fine Offset issues and the (file may need to be linked to where MX wants it) file link instructions]


==Changing the Source List==
==Changing the Source List==
Line 191: Line 207:
===Add the Mono repository for a Raspberry Pi===
===Add the Mono repository for a Raspberry Pi===


The two Mono repositories listed here are specific to the 2017 and 2019 releases (respectively) of the operating system for a Raspberry Pi computer.  These are taken from  [https://www.mono-project.com/download/stable/#download-lin-raspbian].
The two Mono repositories listed here are specific to the 2017 and 2019 releases (respectively) of the operating system for a Raspberry Pi computer.  These are taken from  [https://www.mono-project.com/download/stable/#download-lin-raspbian download-lin-raspbian].


# the first line (in each case) installs a certificate
# the first line (in each case) installs a certificate
# the echo line defines a repository to add to the sources list.
# the echo line defines a repository to add to the sources list.


{| class="wikitable" border="1"
{| class="wikitable" border="0"
|-
|-
!style="width:450px" | Raspberry Operating System 9 (stretch)
!style="width:450px" | Raspberry Operating System 9 (stretch)
!style="width:450px" | Raspberry Operating System 10 (buster)
!style="width:450px" | Raspberry Operating System 10 (buster)
|-
|-
|<code>sudo apt install apt-transport-https dirmngr gnupg ca-certificates<br>
| sudo apt install apt-transport-https dirmngr gnupg ca-certificates<
<br>
| sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF<br>
|-
<br>
| <code>sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF</code>
echo "deb https://download.mono-project.com/repo/debian stable-raspbianstretch main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
| <code>sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF</code>
</code>
|-
|<code>sudo apt install apt-transport-https dirmngr gnupg ca-certificates<br>
| <nowiki>echo "deb https://download.mono-project.com/repo/debian stable-raspbianstretch main"</nowiki>
<br>
| <nowiki>echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main"</nowiki>
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF<br>
|-
<br>
| sudo tee /etc/apt/sources.list.d/mono-official-stable.list
 
| sudo tee /etc/apt/sources.list.d/mono-official-stable.list
echo "deb https://download.mono-project.com/repo/debian stable-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
</code>
|}
|}


==Add the Mono repository to Ubuntu, Debian, Fedora==
===Add the Mono repository to Ubuntu, Debian, Fedora===


At time of writing, [https://www.mono-project.com/download/stable/#download-lin-ubuntu], shows the instructions for versions 16, 18, and 20 of Ubuntu.
At time of writing, [https://www.mono-project.com/download/stable/#download-lin-ubuntu download-lin-ubuntu], shows the instructions for versions 16, 18, and 20 of Ubuntu.


Equally, [https://www.mono-project.com/download/stable/#download-lin-debian], gives details for debian, and [https://www.mono-project.com/download/stable/#download-lin-fedora] for Fedora.
Equally, [https://www.mono-project.com/download/stable/#download-lin-debian download-lin-debian], gives details for debian, and [https://www.mono-project.com/download/stable/#download-lin-fedora] for Fedora.


Others can be found by choosing other tabs on any of those links.
Others can be found by choosing other tabs on any of those links.
Line 387: Line 401:
This could be applicable if you are using Extra Web files.
This could be applicable if you are using Extra Web files.


So if the ini file reads
Here is an example changing the case and the separators: ''Web\extrapageT.htm'' in Windows, changed to read '''web/extrapageT.htm''' in Linux.
Web\extrapageT.htm in Windows,
it must be changed to read web/extrapageT.htm in Linux.
 


=Running MX on Linux=
=Running MX on Linux=
Line 396: Line 407:
This section explores the optional parameters, and then covers 2 ways to run MX:
This section explores the optional parameters, and then covers 2 ways to run MX:
# as a service and  
# as a service and  
#directly with terminal window left open.
# interactively with terminal window left open.


== Optional parameters to add to the instruction to run the MX engine ==
== Optional parameters to add to the instruction to run the MX engine ==
Line 405: Line 416:


Note that you ''may'' need to supply your root password after typing any 'sudo ...' command line if the instruction changes something set by another package (e.g. changing the locale for MX from the locale set by mono). The system will prompt you for this if it is needed.
Note that you ''may'' need to supply your root password after typing any 'sudo ...' command line if the instruction changes something set by another package (e.g. changing the locale for MX from the locale set by mono). The system will prompt you for this if it is needed.
=== Version 3.0.0 Beta builds of MX ===
The following two parameters cannot be used with MX since it came out of 3.0.0 beta.
==== web sockets ====
Beta builds in MX version 3.0.0 had an optional parameter <code>sudo mono EXISTING PATH/CumulusMX/CumulusMX.exe -wsport nnnn</code> that determined which port (represented by a 4 digit number ''nnnn'') was used for '''Web Sockets'''.
That parameter is now deprecated as Web Sockets in all builds since 3045 uses the same port as the rest of the [[MX_Administrative_Interface#The_API_interface|Admin Interface]], see Port parameter below.
==== Debugging of data flow between station and MX====
Use '''sudo mono CumulusMX.exe -Logging=1''' (for the station to MX transfers to have increased debugging logging).
Note use of this parameter is now deprecated.
Although this is not mentioned in any release announcements, it appears that on all recent MX releases this effect is incorporated into the '''-debug''' parameter.  Perhaps someone could confirm whether this is true.


=== Parameter for changing Port ===
=== Parameter for changing Port ===
Line 429: Line 421:
When Cumulus starts, it will display the URL of the user interface. It runs on port 8998 by default; if this is not suitable for some reason you can over-ride it using the '-port' parameter on the command line, e.g. to use port 9999 instead:
When Cumulus starts, it will display the URL of the user interface. It runs on port 8998 by default; if this is not suitable for some reason you can over-ride it using the '-port' parameter on the command line, e.g. to use port 9999 instead:
<pre>sudo mono CumulusMX.exe -port 9999</pre>
<pre>sudo mono CumulusMX.exe -port 9999</pre>
=== Parameter for adding debugging ===
MX has a default level of logging that stores in the [[MXdiags_folder]] folder a log file that shows some of the interaction with the weather station and some of the output actions done as MX runs. A new log is started each time MX is restarted.
If there is a problem, then there is a great benefit in actually increasing the level of detail in these logs; and that is done either within the settings (on recent MX releases this is on '''Program Settings''' page of admin interface - please see [[MXdiags_folder]] page for details) or by adding a parameter: 
:<code>sudo mono CumulusMX.exe -debug</code>


=== Parameter for changing Locale ===
=== Parameter for changing Locale ===
Line 494: Line 477:
WantedBy=multi-user.target</pre>
WantedBy=multi-user.target</pre>


== Setting up as a service release 3.8.0 ==
== Setting up as a service in release 3.8.0 ==


Skip this sub-section for latest release.   
Skip this sub-section for latest release.   
Line 502: Line 485:
# Type <code> mono-service -l:/var/run/cmx.pid CumulusMX.exe -service</code>
# Type <code> mono-service -l:/var/run/cmx.pid CumulusMX.exe -service</code>
# (to verify) note this does not allow you to add -port, -debug, -locale parameters
# (to verify) note this does not allow you to add -port, -debug, -locale parameters
=== Parameter for adding debugging ===
MX has a default level of logging that stores in the [[MXdiags_folder]] folder a log file that shows some of the interaction with the weather station and some of the output actions done as MX runs. A new log is started each time MX is restarted.
If there is a problem, then there is a great benefit in actually increasing the level of detail in these logs; and that is done either within the settings (on recent MX releases this is on '''Program Settings''' page of admin interface - please see [[MXdiags_folder]] page for details) or by adding a parameter: 
:<code>sudo mono CumulusMX.exe -debug</code>
=== Parameters only applicable to Version 3.0.0 Beta builds of MX ===
The following two parameters cannot be used with MX since it came out of 3.0.0 beta.
==== web sockets ====
Beta builds in MX version 3.0.0 had an optional parameter <code>sudo mono EXISTING PATH/CumulusMX/CumulusMX.exe -wsport nnnn</code> that determined which port (represented by a 4 digit number ''nnnn'') was used for '''Web Sockets'''.
That parameter [https://cumulus.hosiene.co.uk/viewtopic.php?f=40&t=17887&p=138815&hilit=sockets#p138815 is now deprecated as Web Sockets in all builds since 3045] use the same port for web sockets as for the HTTP port of the [[MX_Administrative_Interface#The_API_interface|Admin Interface]], see -port parameter described earlier.
==== Debugging of data flow between station and MX====
Use '''sudo mono CumulusMX.exe -Logging=1''' (for the station to MX transfers to have increased debugging logging).
Note use of this parameter is now deprecated.
Although this is not mentioned in any release announcements, it appears that on all recent MX releases this effect is incorporated into the '''-debug''' parameter described earlier.  Perhaps someone could confirm whether this is true.


==Running as a service==
==Running as a service==
5,838

edits

Navigation menu