Tuesday, November 2, 2021

[SOLVED] CentOS - Insufficient memory for the java runtime

Issue

I want to install jenkins on my server, unfortunately, I can't run Java, i have this error :

There is insufficient memory for the Java Runtime Environment to continue

Error

Result of free -m : free There is 2,7Go RAM free.

I set JAVA_OPTS : export JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=256m"

So, I tried a lot of things, but it's impossible to start java...

If anyone has any ideas

thx.


Solution

The short answer is that you're running into selinux enforcement. The quick solution is to set selinux to "permissive" via

setenforce 0

There's longer explanations that you can find if you search for "selinux openjdk os::commit_memory permission denied"

How and why does "setenforce 0" allow Java 7 to run?



Answered By - Adam vonNieda