Getting JAVA ERROR when I run elasticsearch on UBUNTU

Hi All, I have installed the elasticsearch on my Ubuntu laptop . I have Java version 11 as well. However when I run the command ./elasticsearch , it is giving me the following errors. I am new to the elasticsearch, kindly help me out to solve this problem. I appreciate your kind help.


Venu@venu-INVALID:~/elasticsearch-6.5.4/bin$ java -version

java version "11.0.1" 2018-10-16 LTS

Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)

Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)


venu@venu-INVALID:~/elasticsearch-6.5.4/bin$ ./elasticsearch

Exception in thread "main" java.nio.file.AccessDeniedException: /home/venu/elasticsearch-6.5.4/config/jvm.options

at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)

at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)

at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215)

at java.base/java.nio.file.Files.newByteChannel(Files.java:370)

at java.base/java.nio.file.Files.newByteChannel(Files.java:421)

at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)

at java.base/java.nio.file.Files.newInputStream(Files.java:155)

at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:60)

Also, when I try to run it with sudo option, it gives me the following error.

venu@venu-INVALID:~/elasticsearch-6.5.4/bin$ sudo ./elasticsearch
[sudo] password for venu:
Java HotSpot(TM) 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Java HotSpot(TM) 64-Bit Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=1
[2018-12-31T13:45:02,155][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.5.4.jar:6.5.4]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.5.4.jar:6.5.4]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.5.4.jar:6.5.4]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.5.4.jar:6.5.4]
... 6 more

It looks like the user you are trying to run as doesn't have access to read the ES configuration files.
It's probably something you can fix with chmod but I don't how your system is configured.

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