/usr/share/elasticsearch/bin/elasticsearch

Hi, thanks in advance for the help.
I installed Elasticsearch in a thousand ways and I always get the same error. Can someone guide me where to start exploring?

Thank you very much!

elasticsearch@test:~$ /usr/share/elasticsearch/bin/elasticsearch
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
[2022-12-07T04:47:01,388][INFO ][o.e.n.Node ] [test] version[7.17.7], pid[10726], build[default/deb/78dcaaa8cee33438b91eca7f5c7f56a70fec9e80/2022-10-17T15:29:54.167373105Z], OS[Linux/5.15.0-56-generic/amd64], JVM[Private Build/OpenJDK 64-Bit Server VM/18.0.2-ea/18.0.2-ea+9-Ubuntu-222.04]
[2022-12-07T04:47:01,394][INFO ][o.e.n.Node ] [test] JVM home [/usr/lib/jvm/java-18-openjdk-amd64], using bundled JDK [false]
[2022-12-07T04:47:01,395][INFO ][o.e.n.Node ] [test] JVM arguments [-Xshare:auto, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -XX:+ShowCodeDetailsInExceptionMessages, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=ALL-UNNAMED, -Djava.security.manager=allow, -XX:+UseG1GC, -Djava.io.tmpdir=/tmp/elasticsearch-8402595617624343269, -XX:+HeapDumpOnOutOfMemoryError, -XX:+ExitOnOutOfMemoryError, -XX:HeapDumpPath=/var/lib/elasticsearch, -XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Xms3957m, -Xmx3957m, -XX:MaxDirectMemorySize=2075131904, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/etc/elasticsearch, -Des.distribution.flavor=default, -Des.distribution.type=deb, -Des.bundled_jdk=true]
[2022-12-07T04:47:04,177][INFO ][o.e.p.PluginsService ] [test] loaded module [aggs-matrix-stats]
[2022-12-07T04:47:04,178][INFO ][o.e.p.PluginsService ] [test] loaded module [analysis-common]
[2022-12-07T04:47:04,178][INFO ][o.e.p.PluginsService ] [test] loaded module [constant-keyword]
[2022-12-07T04:47:04,179][INFO ][o.e.p.PluginsService ] [test] loaded module [frozen-indices]
[2022-12-07T04:47:04,179][INFO ][o.e.p.PluginsService ] [test] loaded module [ingest-common]
[2022-12-07T04:47:04,179][INFO ][o.e.p.PluginsService ] [test] loaded module [ingest-geoip]
[2022-12-07T04:47:04,179][INFO ][o.e.p.PluginsService ] [test] loaded module [ingest-user-agent]
[2022-12-07T04:47:04,180][INFO ][o.e.p.PluginsService ] [test] loaded module [kibana]
[2022-12-07T04:47:04,180][INFO ][o.e.p.PluginsService ] [test] loaded module [lang-expression]
[2022-12-07T04:47:04,180][INFO ][o.e.p.PluginsService ] [test] loaded module [lang-mustache]
[2022-12-07T04:47:04,181][INFO ][o.e.p.PluginsService ] [test] loaded module [lang-painless]
[2022-12-07T04:47:04,181][INFO ][o.e.p.PluginsService ] [test] loaded module [legacy-geo]
[2022-12-07T04:47:04,182][INFO ][o.e.p.PluginsService ] [test] loaded module [mapper-extras]
[2022-12-07T04:47:04,182][INFO ][o.e.p.PluginsService ] [test] loaded module [mapper-version]
[2022-12-07T04:47:04,182][INFO ][o.e.p.PluginsService ] [test] loaded module [parent-join]
[2022-12-07T04:47:04,183][INFO ][o.e.p.PluginsService ] [test] loaded module [percolator]
[2022-12-07T04:47:04,183][INFO ][o.e.p.PluginsService ] [test] loaded module [rank-eval]
[2022-12-07T04:47:04,183][INFO ][o.e.p.PluginsService ] [test] loaded module [reindex]
[2022-12-07T04:47:04,183][INFO ][o.e.p.PluginsService ] [test] loaded module [repositories-metering-api]
[2022-12-07T04:47:04,184][INFO ][o.e.p.PluginsService ] [test] loaded module [repository-encrypted]
[2022-12-07T04:47:04,184][INFO ][o.e.p.PluginsService ] [test] loaded module [repository-url]
[2022-12-07T04:47:04,184][INFO ][o.e.p.PluginsService ] [test] loaded module [runtime-fields-common]
[2022-12-07T04:47:04,184][INFO ][o.e.p.PluginsService ] [test] loaded module [search-business-rules]
[2022-12-07T04:47:04,185][INFO ][o.e.p.PluginsService ] [test] loaded module [searchable-snapshots]
[2022-12-07T04:47:04,185][INFO ][o.e.p.PluginsService ] [test] loaded module [snapshot-repo-test-kit]
[2022-12-07T04:47:04,185][INFO ][o.e.p.PluginsService ] [test] loaded module [spatial]
[2022-12-07T04:47:04,185][INFO ][o.e.p.PluginsService ] [test] loaded module [systemd]
[2022-12-07T04:47:04,186][INFO ][o.e.p.PluginsService ] [test] loaded module [transform]
[2022-12-07T04:47:04,186][INFO ][o.e.p.PluginsService ] [test] loaded module [transport-netty4]
[2022-12-07T04:47:04,189][INFO ][o.e.p.PluginsService ] [test] loaded module [unsigned-long]
[2022-12-07T04:47:04,189][INFO ][o.e.p.PluginsService ] [test] loaded module [vector-tile]
[2022-12-07T04:47:04,190][INFO ][o.e.p.PluginsService ] [test] loaded module [vectors]
[2022-12-07T04:47:04,190][INFO ][o.e.p.PluginsService ] [test] loaded module [wildcard]
[2022-12-07T04:47:04,190][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-aggregate-metric]
[2022-12-07T04:47:04,190][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-analytics]
[2022-12-07T04:47:04,191][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-async]
[2022-12-07T04:47:04,191][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-async-search]
[2022-12-07T04:47:04,191][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-autoscaling]
[2022-12-07T04:47:04,192][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-ccr]
[2022-12-07T04:47:04,192][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-core]
[2022-12-07T04:47:04,193][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-data-streams]
[2022-12-07T04:47:04,193][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-deprecation]
[2022-12-07T04:47:04,193][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-enrich]
[2022-12-07T04:47:04,193][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-eql]
[2022-12-07T04:47:04,193][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-fleet]
[2022-12-07T04:47:04,194][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-graph]
[2022-12-07T04:47:04,194][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-identity-provider]
[2022-12-07T04:47:04,194][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-ilm]
[2022-12-07T04:47:04,194][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-logstash]
[2022-12-07T04:47:04,195][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-ml]
[2022-12-07T04:47:04,195][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-monitoring]
[2022-12-07T04:47:04,195][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-ql]
[2022-12-07T04:47:04,195][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-rollup]
[2022-12-07T04:47:04,195][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-security]
[2022-12-07T04:47:04,196][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-shutdown]
[2022-12-07T04:47:04,196][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-sql]
[2022-12-07T04:47:04,196][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-stack]
[2022-12-07T04:47:04,197][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-text-structure]
[2022-12-07T04:47:04,197][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-voting-only-node]
[2022-12-07T04:47:04,197][INFO ][o.e.p.PluginsService ] [test] loaded module [x-pack-watcher]
[2022-12-07T04:47:04,198][INFO ][o.e.p.PluginsService ] [test] no plugins loaded
[2022-12-07T04:47:04,251][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [test] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:173) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112) ~[elasticsearch-cli-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-cli-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.7.jar:7.17.7]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:328) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.node.Node.(Node.java:429) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.node.Node.(Node.java:309) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169) ~[elasticsearch-7.17.7.jar:7.17.7]
... 6 more
uncaught exception in thread [main]
java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:328)
at org.elasticsearch.node.Node.(Node.java:429)
at org.elasticsearch.node.Node.(Node.java:309)
at org.elasticsearch.bootstrap.Bootstrap$5.(Bootstrap.java:234)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:234)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169)
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:160)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
For complete error details, refer to the log at /var/log/elasticsearch/elasticsearch.log
elasticsearch@test:~$ /var/log/elasticsearch/elasticsearch.log
-bash: /var/log/elasticsearch/elasticsearch.log: Permission denied
elasticsearch@test:~$ echo $JAVA_HOME
/usr/lib/jvm/java-1.18.0-openjdk-amd64
elasticsearch@test:~$ echo $ES_JAVA_HOME
/usr/lib/jvm/java-11-openjdk-amd64
elasticsearch@test:~$

Welcome to our community! :smiley:

How did you install Elasticsearch exactly, which documentation did you follow?

It sounds like you have tried in install/run Elasticsearch and there was some issue. If you haven't loaded data into it, I would stop Elasticsearch and then rm -rf /var/lib/elasticsearch/ and then try starting Elasticsearch again.

Hello, thanks for answering...
When I want to delete, execute the command rm -rf /var/lib/elasticsearch/ I got "permission denied" then run it with sudo
Then I ran ./bin/elasticsearch again
I was following this instructive

I can delete the installation and reinstall if you recommend a guide.

/usr/share/elasticsearch/bin/elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in ve rsion 9.0 and will likely be removed in a future release.
[2022-12-07T11:18:32,901][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [t est] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: U nable to access 'path.data' (/var/lib/elasticsearch)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:173 ) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java: 160) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar eCommand.java:77) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1 12) ~[elasticsearch-cli-7.17.7.jar:7.17.7]
at org.elasticsearch.cli.Command.main(Command.java:77) ~[elasticsearch-c li-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125 ) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-7.17.7.jar:7.17.7]
Caused by: java.lang.IllegalStateException: Unable to access 'path.data' (/var/l ib/elasticsearch)
at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(File PermissionUtils.java:66) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java :226) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java: 168) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.configure(Security.java:115) ~[e lasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229) ~[ela sticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elas ticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169 ) ~[elasticsearch-7.17.7.jar:7.17.7]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /var/lib/elasticsearch
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:90 ) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvi der.java:389) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:690) ~[?:?]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:797) ~[?:?]
at java.nio.file.Files.createDirectories(Files.java:783) ~[?:?]
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.j ava:318) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(File PermissionUtils.java:64) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java :226) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java: 168) ~[elasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Security.configure(Security.java:115) ~[e lasticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229) ~[ela sticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434) ~[elas ticsearch-7.17.7.jar:7.17.7]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169 ) ~[elasticsearch-7.17.7.jar:7.17.7]
... 6 more
uncaught exception in thread [main]
java.lang.IllegalStateException: Unable to access 'path.data' (/var/lib/elastics earch)
Likely root cause: java.nio.file.AccessDeniedException: /var/lib/elasticsearch
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixExcepti on.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.createDirectory(UnixFileS ystemProvider.java:389)
at java.base/java.nio.file.Files.createDirectory(Files.java:690)
at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:79 7)
at java.base/java.nio.file.Files.createDirectories(Files.java:783)
at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.j ava:318)
at org.elasticsearch.bootstrap.FilePermissionUtils.addDirectoryPath(File PermissionUtils.java:64)
at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java :226)
at org.elasticsearch.bootstrap.Security.createPermissions(Security.java: 168)
at org.elasticsearch.bootstrap.Security.configure(Security.java:115)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:229)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:434)
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:169 )
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java: 160)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwar eCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:1 12)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:125 )
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
For complete error details, refer to the log at /var/log/elasticsearch/elasticse arch.log

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