Elasticsearch 8 won't start on Centos 7

I have installed Elasticsearch 7.8 on centos 7 server and it was running normally.
After uninstalling it and installing elasticsearch 8.8, I get the following error when trying to start it with the command
sudo systemctl start elasticsearch
Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.

I have tried to modify the default network.host and host.port settings to network.host: 0.0.0.0 and http.port: 9200 to fix the issue, but it didn't fix the error.

Check the logs at the /var/log/elasticsearch directory.
If there is no details, change rootLogger.level to debug in log4j2.properties, and restart ES.

By default, you need 50% free RAM and 15% free disk space.

Hi Rios, thanks for your reply.

Here is the error I get in the logs:

> [2023-06-23T02:41:20,712][ERROR][o.e.b.Elasticsearch      ] [6747283.taalim.space] fatal exception while booting Elasticsearch
> java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
>         at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:23) ~[?:?]
>         at java.security.AccessController.doPrivileged(AccessController.java:319) ~[?:?]
>         at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:22) ~[?:?]
>         at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:117) ~[?:?]
>         at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:128) ~[?:?]
>         at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
>         at org.elasticsearch.node.Node.start(Node.java:1515) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.start(Elasticsearch.java:438) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:231) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:67) ~[elasticsearch-8.8.1.jar:?]
> Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: /tmp/elasticsearch-11646769667885113193/jna1982191581823228932.tmp: /tmp/elasticsearch-11646769667885113193/jna1982191581823228932.tmp: failed to map segment from shared object: Operation not permitted [in thread "main"]
>         at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
>         at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331) ~[?:?]
>         at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197) ~[?:?]
>         at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139) ~[?:?]
>         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404) ~[?:?]
>         at java.lang.Runtime.load0(Runtime.java:817) ~[?:?]
>         at java.lang.System.load(System.java:2015) ~[?:?]
>         at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1045) ~[jna-5.10.0.jar:?]
>         at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) ~[jna-5.10.0.jar:?]
>         at com.sun.jna.Native.<clinit>(Native.java:221) ~[jna-5.10.0.jar:?]
>         at java.lang.Class.forName0(Native Method) ~[?:?]
>         at java.lang.Class.forName(Class.java:391) ~[?:?]
>         at java.lang.Class.forName(Class.java:382) ~[?:?]
>         at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:34) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.initializeNatives(Elasticsearch.java:261) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.initPhase2(Elasticsearch.java:161) ~[elasticsearch-8.8.1.jar:?]
>         at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:66) ~[elasticsearch-8.8.1.jar:?]

1 Like

I just solved the issue by:

Changing in /etc/elasticsearch/jvm.options

#-Djava.io.tmpdir=${ES_TMPDIR}

-Djava.io.tmpdir=/var/log/elasticsearch

2 Likes

elasticsearch user or user under which you are running process doesn't have permissions on tmp directory.
Yes, that's change ${ES_TMPDIR} or -Djava.io.tmpdir in jvm.options

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.