java lang RuntimeException can not run elasticsearch as root

0 votes

Hi Guys,

I am trying to run the ElasticSearch server, but it is showing me the below error.

[2020-06-18T14:07:06,854][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [localhost.localdomain] 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:174) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127) ~[elasticsearch-cli-7.7.1.jar:7.7.1]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.7.1.jar:7.7.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393) ~[elasticsearch-7.7.1.jar:7.7.1]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.7.1.jar:7.7.1]
        ... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:111)
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:393)
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
        at org.elasticsearch.cli.Command.main(Command.java:90)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
For complete error details, refer to the log at /root/elasticsearch-7.7.1/logs/elasticsearch.log
[root@localhost bin]# 2020-06-18 18:07:07,218651 UTC [28855] ERROR CNamedPipeFactory.cc@224 Unable to open named pipe /tmp/elasticsearch-8997654485246994218/controller_log_28720 for writing: Interrupted system call
2020-06-18 18:07:07,218784 UTC [28855] ERROR CLogger.cc@298 Cannot log to named pipe /tmp/elasticsearch-8997654485246994218/controller_log_28720 as it could not be opened for writing
2020-06-18 18:07:07,218918 UTC [28855] FATAL Main.cc@102 Could not reconfigure logging
Jun 19, 2020 in ELK Stack by akhtar
• 38,210 points
4,616 views

1 answer to this question.

+1 vote

Hi@akhtar,

ElasticSearch will not require root privilege to run the server. So you need to create one user named elasticsearch and then try to run the ElasticSearch program. You can follow the below-given commands.

groupadd elasticsearch
useradd elasticsearch -g elasticsearch -p elasticsearch
cd /opt
chown -R elasticsearch:elasticsearch /root/elasticsearch
chmod o+x /root/ /root/elasticsearch/
chgrp elasticsearch /root/elasticsearch/
su - elasticsearch
cd /root/elasticsearch/elasticsearch-7.4.0
./bin/elasticsearch

Hope it helps!!

If not then its recommended to join our Java training class and learn about Java in detail.

Thank You!!

answered Jun 19, 2020 by MD
• 95,300 points

Related Questions In ELK Stack

0 votes
1 answer

java.lang.IllegalArgumentException: Invalid bracketed host/port range.

Hi@akhtar, You need to set the hostname in ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,300 points
548 views
0 votes
1 answer

How to install Elasticsearch tool in Linux System ?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,300 points
243 views
0 votes
1 answer

How to integrate Logstash with ElasticSearch?

Hi@akhtar, You can use elasticsearch plugin to integrate ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,300 points
261 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,297 views
+2 votes
1 answer
0 votes
2 answers

How to run Elasticsearch as root user in Linux machine?

Step 1: Pull images of elastic search ...READ MORE

answered Jun 19, 2020 in ELK Stack by Pawan
• 380 points
2,829 views
0 votes
1 answer

bash: cd: root/elasticsearch/: Permission denied

Hi@akhtar, You need to set permission for elasticsearch ...READ MORE

answered Jun 19, 2020 in ELK Stack by MD
• 95,300 points
1,915 views