# Failed to start elastic search

**URL:** <https://discuss.elastic.co/t/failed-to-start-elastic-search/273323>\
**Category:** Elasticsearch\
**Created:** [May 18, 2021, 4:54pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323 "2021-05-18T16:54:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 18, 2021, 4:54pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/1 "2021-05-18T16:54:31Z")

</div>

Good evening, all seems ok, I have installed java 11, etc...  
But when I want to start the service I have somes errors...  
I put you the commandes and answers in putty :

```auto
[root@ortie-bio ~]# systemctl start elasticsearch.service
Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
[root@ortie-bio ~]#
[root@ortie-bio ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2021-05-19 16:18:45 CEST; 3min 7s ago
     Docs: https://www.elastic.co
  Process: 79231 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
 Main PID: 79231 (code=exited, status=1/FAILURE)

May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: Error: Could not create the Java Virtual Machine.
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: Error: A fatal exception has occurred. Program will exit.
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: at org.elasticsearch.tools.launchers.JvmOption.flagsFinal(JvmOption.java:119)
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: at org.elasticsearch.tools.launchers.JvmOption.findFinalOptions(JvmOption.java:81)
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:38)
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:135)
May 19 16:18:45 ortie-bio systemd-entrypoint[79231]: at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
May 19 16:18:45 ortie-bio systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
May 19 16:18:45 ortie-bio systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
May 19 16:18:45 ortie-bio systemd[1]: Failed to start Elasticsearch.
[root@ortie-bio ~]#

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 19, 2021, 1:08am UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/2 "2021-05-19T01:08:25Z")

</div>

Welcome to our community! 😃

Please don't post pictures of text, they are difficult to read, impossible to search and replicate (if it's code), and some people may not be even able to see them 🙂

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 19, 2021, 2:26pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/3 "2021-05-19T14:26:23Z")

</div>

Ok, I have modify my post, is it ok for you?

---

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [May 19, 2021, 2:30pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/4 "2021-05-19T14:30:59Z")

</div>

once i had also faced this issue . if you are using a linux machine pls check the owner for the elasticsearch data directory. it should be **elasticsearch** and not **root**

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 19, 2021, 9:46pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/5 "2021-05-19T21:46:02Z")

</div>

ok, is the data directory in var/lib ? if it is the case I have rabitmq as owner... is it normal?  
drwxr-s---. 3 rabbitmq rabbitmq 19 May 14 00:46 elasticsearch  
I give you some others directory in case :  
usr/share : drwxr-xr-x. 7 elasticsearch elasticsearch 129 May 14 00:19 elasticsearch  
etc/ : drwxr-s---. 3 elasticsearch elasticsearch 245 May 18 18:18 elasticsearch  
etc/sysconfig : -rw-rw----. 1 elasticsearch elasticsearch 1676 Apr 20 23:04 elasticsearch  
In other wise I just realised I did all install login in root... I did create a magento user before the installation of magento, perhaps I should try to re-install java and elasticsearch login with this user?

---

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [May 19, 2021, 10:10pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/6 "2021-05-19T22:10:10Z")

</div>

Yes it will be in the path /var/lib. You can check elasticsearch.yml file for finding the data directory.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 19, 2021, 10:13pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/7 "2021-05-19T22:13:45Z")

</div>

What does your Elasticsearch show?

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 20, 2021, 6:55am UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/8 "2021-05-20T06:55:21Z")

</div>

Good morning  
I can't go in the elasticsearch.yml and start with magento login:

```auto
[magento@ortie-bio /]$ sudo cd/etc/elasticsearch
sudo: /etc/sudo.conf is owned by uid 990, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
[magento@ortie-bio /]$ sudo vi /etc/elasticsearch/elasticsearch.yml
sudo: /etc/sudo.conf is owned by uid 990, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
[magento@ortie-bio /]$[magento@ortie-bio /]$ sudo systemctl elasticsearch.service
sudo: /etc/sudo.conf is owned by uid 990, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
[magento@ortie-bio /]$

```

But I can enter the directory and edit the file with root login :

```auto
            #
    http.port: 9200
    #
    # For more information, consult the network module documentation.
    #
    # --------------------------------- Discovery ----------------------------------
    #
    # Pass an initial list of hosts to perform discovery when this node is started:
    # The default list of hosts is ["127.0.0.1", "[::1]"]
    #
    #discovery.seed_hosts: ["host1", "host2"]
    #
    # Bootstrap the cluster using an initial set of master-eligible nodes:
    #
    #cluster.initial_master_nodes: ["node-1", "node-2"]
    #
    # For more information, consult the discovery and cluster formation module documentation.
    #
    # ---------------------------------- Various -----------------------------------
    #
    # Require explicit names when deleting indices:
    #
    #action.destructive_requires_name: true
    -- INSERT --

```

In root login for the start :

```auto
[root@ortie-bio /]# systemctl start elasticsearch.service
Job for elasticsearch.service failed because the control process exited with error code.
See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
[root@ortie-bio /]#

```

---

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [May 20, 2021, 6:02pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/9 "2021-05-20T18:02:54Z")

</div>

You will always need root user privilege to edit yml files.

Please go through the below topic to fix your error

> <https://stackoverflow.com/questions/58656747/elasticsearch-job-for-elasticsearch-service-failed>

---

<div class="post-metadata">

**Author:** ![Gokul6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gokul6/32/84049_2.png) [@Gokul6](https://discuss.elastic.co/u/Gokul6)\
**Post date:** [May 20, 2021, 6:40pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/10 "2021-05-20T18:40:30Z")

</div>

@cedler from the above stack overflow topic please take these two things into consideration to fix your issue.

1. network settings  

2. owner of the directory

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 20, 2021, 10:45pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/11 "2021-05-20T22:45:48Z")

</div>

ok, Thanks you gokul6 to try to help me but I did tried all that and with the link you suggested too but always no starting...  
For the rights :

```auto
drwxr-s---. 3 elasticsearch elasticsearch 245 May 20 23:55 elasticsearch

```

For the elasticsearch.yml :

```auto
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 127.0.0.1
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: []
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

```

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 20, 2021, 10:58pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/12 "2021-05-20T22:58:02Z")

</div>

For the options.jvm :

```auto
################################################################
## Expert settings
################################################################
##
## All settings below here are considered expert settings. Do
## not adjust them unless you understand what you are doing. Do
## not edit them in this file; instead, create a new file in the
## jvm.options.d directory containing your adjustments.
##
################################################################

## GC configuration
8-13:-XX:+UseConcMarkSweepGC
8-13:-XX:CMSInitiatingOccupancyFraction=75
8-13:-XX:+UseCMSInitiatingOccupancyOnly

## G1GC Configuration
# NOTE: G1 GC is only supported on JDK version 10 or later
# to use G1GC, uncomment the next two lines and update the version on the
# following three lines to your version of the JDK
# 10-13:-XX:-UseConcMarkSweepGC
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
14-:-XX:+UseG1GC

## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails; heap dumps
# are created in the working directory of the JVM unless an alternative path is
# specified
-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=/var/lib/elasticsearch

# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log

## JDK 8 GC logging
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:/var/log/elasticsearch/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:/var/log/elasticsearch/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m9-:-Xlog:gc*,gc+age=trace,safepoint:file=/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m

```

---

<div class="post-metadata">

**Author:** ![kumarabhi](https://avatars.discourse-cdn.com/v4/letter/k/6a8cbe/32.png) [@kumarabhi](https://discuss.elastic.co/u/kumarabhi)\
**Post date:** [May 21, 2021, 5:39am UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/13 "2021-05-21T05:39:47Z")

</div>

Did you check that there is no problem with Java installation ?

Can you please write a simple Java program and execute it ?

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 22, 2021, 4:32pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/14 "2021-05-22T16:32:54Z")

</div>

Good evening,  
I have all uninstalled (java+elasticsearch) and re-install, always the same... but in elasticsearch.yml I did put a distant ip adress whereas I installed it on my server... so I put a "#" at this line in comment and it works now...  
Thnaks you

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 22, 2021, 4:46pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/15 "2021-05-22T16:46:13Z")

</div>

And what are the full logs when you uncomment?

Probably related to [Bootstrap Checks | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html)

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 22, 2021, 4:58pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/16 "2021-05-22T16:58:29Z")

</div>

Sorry, you want to see which file or command?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 22, 2021, 5:09pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/17 "2021-05-22T17:09:14Z")

</div>

Elasticsearch logs.

---

<div class="post-metadata">

**Author:** ![cedler](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cedler](https://discuss.elastic.co/u/cedler)\
**Post date:** [May 22, 2021, 5:25pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/18 "2021-05-22T17:25:59Z")

</div>

Don't have time to search where is the logs files if you don't want to tell me... sorry ... here is the journalctl-xe if I put my adress ip :

```auto
-- Unit elasticsearch.service has finished shutting down.
May 22 19:18:43 ortie-bio systemd[1]: Starting Elasticsearch...
-- Subject: Unit elasticsearch.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit elasticsearch.service has begun starting up.
May 22 19:18:59 ortie-bio systemd-entrypoint[350178]: ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
May 22 19:18:59 ortie-bio systemd-entrypoint[350178]: bootstrap check failure [1] of [1]: the default discovery settings are unsuitable for production use; at least one of [discovery.se>
May 22 19:18:59 ortie-bio systemd-entrypoint[350178]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/cluster-ortie-bio.log
May 22 19:18:59 ortie-bio systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/CONFIG
May 22 19:18:59 ortie-bio systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit elasticsearch.service has entered the 'failed' state with result 'exit-code'.
May 22 19:18:59 ortie-bio systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit elasticsearch.service has failed.
--
-- The result is failed.
May 22 19:19:15 ortie-bio sshd[350417]: sshd_selinux_change_privsep_preauth_context: SELinux context file needs to be owned by root and not writable by anyone else [preauth]
May 22 19:19:15 ortie-bio sshd[350079]: Connection closed by invalid user default 202.80.219.16 port 3509 [preauth]
May 22 19:19:16 ortie-bio sshd[350417]: Invalid user fjc from 202.51.74.221 port 56319
May 22 19:19:16 ortie-bio sshd[350417]: pam_unix(sshd:auth): check pass; user unknown
May 22 19:19:16 ortie-bio sshd[350417]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=202.51.74.221
May 22 19:19:17 ortie-bio sshd[350417]: Failed password for invalid user fjc from 202.51.74.221 port 56319 ssh2
May 22 19:19:18 ortie-bio sshd[350417]: Received disconnect from 202.51.74.221 port 56319:11: Bye Bye [preauth]
May 22 19:19:18 ortie-bio sshd[350417]: Disconnected from invalid user fjc 202.51.74.221 port 56319 [preauth]

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 22, 2021, 10:27pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/19 "2021-05-22T22:27:36Z")

</div>

It depends on how you installed elasticsearch.

Here is an example in the docs: [Install Elasticsearch with Debian Package | Elasticsearch Guide [7.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-layout)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 19, 2021, 10:28pm UTC](https://discuss.elastic.co/t/failed-to-start-elastic-search/273323/20 "2021-06-19T22:28:08Z")

</div>

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