Mango on Linux won't start under mango user, but will with root
-
We have been running Mango on Windows for a couple years now and want to get a Linux server up and going.
We have an Amazon Linux server with all the necessary software installed, and can start the instance using:
sudo ./ma-sh start
The problem is when we try to start the app using the mango user we get the following:
[ec2-user@ip-xxx-xxx-xxx-xxx bin]$ sudo -u mango ./ma.sh start MA_HOME is /opt/mango [ec2-user@ip-xxx-xxx-xxx-xxx bin]$ ma-start: MA started with Process ID: 21478 ma-start: no restart flag found, not restarting MA ma-start: MA done
Some times we get more info on the error and it says:
ERROR 2021-06-02T01:59:07,431 [main] - Error during initialization java.net.SocketException: Permission denied
This seems like a permissions issue, but we're not sure where. /opt/openjdk has been changed to be owned by mango:mango as well as the /opt/mango directory structure.
I've followed the steps in the Linux Install page: https://docs-v3.mango-os.com/linux-installation
I've also followed the advice in this post https://forum.mango-os.com/topic/3278/java-update-to-1-8-162-has-caused-mango-es-3-2-2-to-become-unreachable/13 but that didn't seem to do anything either.
Any help is appreciated.
Thanks,
Chad -
Hi Chad,
My guess is it is a permissions issue on the port. What port are you running Mango on? You might also want to look at the link installation script as this might make your installation easier. https://docs-v3.mango-os.com/install-script
-
Thanks, Joel, I'll try that here shortly and let you know!
We have port 80 specified in our properties file; web.port
Thanks,
Chad -
Joel,
The URL specified for the install script returns a 404 error.
Is there an updated one to use?
Thanks,
Chad -
Hey Chad, sorry about that URL. This is the correct one.
https://raw.githubusercontent.com/infiniteautomation/ma-core-public/main/Core/bin/install-mango.shLooks like this has been updated to work with Mango v4 so hopefully still works for Mango v3.
-
@cmusselm Mango will not be able to bind to port 80 unless the root user starts it. This is a Linux permissions issue. You will need to use IP tables to route port 80 to port 8080
You should see an error like this in the ma.logERROR 2021-06-02T21:15:48,714 (com.serotonin.m2m2.Main.main:162) - Error during initialization java.io.IOException: Failed to bind to /0.0.0.0:80
-
Thanks, Joel.
I was still getting an error, but found this command on Stack Overflow for a post around port permissions and it did the trick for me.
sudo /sbin/sysctl -w net.ipv4.ip_unprivileged_port_start=0
Thanks,
Chad -
This post is deleted! -
Excellent, glad you got it working. Basically, you need to allow unprivileged users access to lower ports. By default, Linux does not allow this.