When I try to start elasticsearch , I get the following
[gefela@gefela bin] ./elasticsearch ./elasticsearch-env: line 75: /etc/sysconfig/elasticsearch: Permission denied [gefela@gefela bin] ^C
What do I need to do to fix this ?
When I try to start elasticsearch , I get the following
[gefela@gefela bin] ./elasticsearch ./elasticsearch-env: line 75: /etc/sysconfig/elasticsearch: Permission denied [gefela@gefela bin] ^C
What do I need to do to fix this ?
I'd follow the installation guide.
I have read it the installation guide but it does not give me the reason why it is failing ..
How did you install elasticsearch? What are the exact commands you are running?
This is the commands thatI used to configure elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.6.2-x86_64.rpm.sha512
sudo rpm --install elasticsearch-7.6.2-x86_64.rpm
yum remove elasticsearch-oss
sudo rpm --install elasticsearch-7.6.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.6.2-x86_64.rpm.sha512
sudo rpm --install elasticsearch-7.6.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm.sha512
shasum -a 512 -c elasticsearch-7.6.2-x86_64.rpm.sha512
sudo rpm --install elasticsearch-7.6.2-x86_64.rpm
sudo systemctl enable elasticsearch.service
cd /usr/share/elasticsearch/
./elasticsearch-users useradd gefela -p password
nano /etc/elasticsearch/elasticsearch.yml
systemctl restart elasticsearch
cd /etc/elasticsearch/
cd /usr/share/elasticsearch/bin/
./elasticsearch
su elasticsearch
chown -R elasticsearch:elasticsearch /etc/elasticsearch/
chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/
./elasticsearch
./elasticsearch
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2020-04-13T19:02:11,853][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [gefela] 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.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.6.2.jar:7.6.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.6.2.jar:7.6.2]
... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349)
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:125)
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 /var/log/elasticsearch/gefela.l
Could you run the process as elasticsearch
user?
It is still giving me the error message ..
[gefela@gefela ~] cd /usr/share/elasticsearch/bin
[gefela@gefela bin] sudo ./elasticsearch
[sudo] password for gefela:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2020-04-14T07:43:51,602][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [gefela] 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.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.6.2.jar:7.6.2]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.6.2.jar:7.6.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.6.2.jar:7.6.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.6.2.jar:7.6.2]
... 6 more
uncaught exception in thread [main]
java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349)
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:125)
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 /var/log/elasticsearch/gefela.log
[gefela@gefela bin] sudo whoami
root
[gefela@gefela bin]
[gefela@gefela bin]$ ./elasticsearch
./elasticsearch-env: line 75: /etc/sysconfig/elasticsearch: Permission denied
[gefela@gefela ~] cd /usr/share/elasticsearch/bin [gefela@gefela bin] sudo ./elasticsearch
Means that you are running as root
.
I have run it as a user ...
[gefela@gefela ~] cd /usr/share/elasticsearch/bin/
[gefela@gefela bin] ./elasticsearch
./elasticsearch-env: line 75: /etc/sysconfig/elasticsearch: Permission denied
[gefela@gefela bin]$
But why are you trying to launch the binary manually?
Documentation says:
sudo -i service elasticsearch start
I have done it but still giving error message
[gefela@gefela bin]$ sudo -i service elasticsearch start
Starting elasticsearch (via systemctl): Job for elasticsearch.service failed because the control process exited with error code.
gefela@gefela bin] sudo systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vend>
Active: failed (Result: exit-code) since Tue 2020-04-14 08:47:59 BST; 43s ago
Docs: http://www.elastic.co
Process: 8267 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p {PID_D>
Main PID: 8267 (code=exited, status=1/FAILURE)
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.bootst>
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.cli.En>
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.cli.Co>
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.cli.Co>
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.bootst>
Apr 14 08:47:59 gefela elasticsearch[8267]: at org.elasticsearch.bootst>
Apr 14 08:47:59 gefela elasticsearch[8267]: For complete error details, refer t>
Apr 14 08:47:59 gefela systemd[1]: elasticsearch.service: Main process exited, >
Apr 14 08:47:59 gefela systemd[1]: elasticsearch.service: Failed with result 'e>
Apr 14 08:47:59 gefela systemd[1]: Failed to start Elasticsearch.
lines 1-17/17 (END)
What are elasticsearch logs in that case?
Please format your code, logs or configuration files using </>
icon as explained in this guide and not the citation button. It will make your post more readable.
Or use markdown style like:
```
CODE
```
This is the icon to use if you are not using markdown format:
There's a live preview panel for exactly this reasons.
Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
I have managed to get a resolution for this by using this guide ..
How do I make elasticsearch ,logstash and kibana start at boot time
Once its installed as a service, it will start automatically.
Did you make it work?
Again, the installation guides are telling how to make the service automatically starting. See for example https://www.elastic.co/guide/en/kibana/current/rpm.html for Kibana. If you have any question regarding Kibana, please open a question in #kibana
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.