# Cannot start elasticsearch on Centos8

**URL:** <https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961>\
**Category:** Elastic Stack\
**Created:** [June 5, 2020, 1:50pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961 "2020-06-05T13:50:09Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 5, 2020, 1:50pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/1 "2020-06-05T13:50:09Z")

</div>

Hi fellows,  
I installed elasticsearch 7 on my centos 8 machine via yum following this howto: [https://www.howtoforge.com/how-to-install-elastic-stack-on-centos-8/](https://www.howtoforge.com/how-to-install-elastic-stack-on-centos-8/)  
Anything worked fine so far, but wehen I try to start elasticsearch I get the following error: _ **`Error: Could not create the Java Virtual Machine.`** _  
In elasticsearch.log I get this Error:  
uncaught exception in thread [main]  
_`org.elasticsearch.bootstrap.StartupException: ElasticsearchException[Failure running machine learning native code.`_  
So I tried this: _`echo "xpack.ml.enabled: false" >> /etc/elasticsearch/elasticsearch.yml`_  
without any success.

My machine has 3GB RAM so I set

```
*-Xms1g*
*-Xmx2g*

```

My elasticsearch.yml you can see here: [https://pastebin.com/m4P5f5qy](https://pastebin.com/m4P5f5qy)

How can I fix that problem.  
Any help is aapreciated.

Many thanks in advance

Uli

---

<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:** [June 5, 2020, 1:52pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/2 "2020-06-05T13:52:24Z")

</div>

Welcome!

No more than half of the available RAM should be allocated to the HEAP.  
See [https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html)

With 3gb of RAM, I'd keep the default configuration.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 5, 2020, 7:17pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/3 "2020-06-05T19:17:09Z")

</div>

Hi dadoonet,  
thanks for your advice , but that isn't the reason for that error I chanded it to 1g and 512m both doesn't solved it.

Regards,  
Uli

---

<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:** [June 6, 2020, 10:11am UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/4 "2020-06-06T10:11:09Z")

</div>

You should use the same value for both.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 3:23pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/5 "2020-06-06T15:23:02Z")

</div>

Hi dadoonet,  
Thanks for you advice I tried 2g 1g 512m und 4g as values , nothing worked.  
_`Invalid initial heap size: -Xms1g`_

Which size would you recommend?  
f _ree -m_  
\* total used free shared buff/cache available\*  
_Mem: 3400 262 2727 9 409 2917_  
_Swap: 1527 0 1527_

Best Regards,

Uli

---

<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:** [June 6, 2020, 3:37pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/6 "2020-06-06T15:37:23Z")

</div>

I'm recommending using the default value. Which means reverting all the changes you did.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 3:39pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/7 "2020-06-06T15:39:01Z")

</div>

that would be 4g that does not work

---

<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:** [June 6, 2020, 3:54pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/8 "2020-06-06T15:54:53Z")

</div>

That's not the default values.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 4:02pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/9 "2020-06-06T16:02:15Z")

</div>

so would you be so nice to tell me what what the default value is? I cannot find a value on google & co for it .

I reinstalled the latest java openjdk-devel-14.0.1.7-2  
but the Virtual Machine can still not be created

_`Error: Could not create the Java Virtual Machine`_

Thanks in advance,

Uli

---

<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:** [June 6, 2020, 5:03pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/10 "2020-06-06T17:03:57Z")

</div>

Download the default distribution. Unzip. Launch. Don't touch any file or settings.

This should work out of the box.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 5:11pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/11 "2020-06-06T17:11:35Z")

</div>

I have to use centos8 so I reinstalled elasticsearch so jvm.options now show Xms and Xmx value 1g but when I try to start elasticsearch I get these errors:

```
*journalctl -xe*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.jav>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: Caused by: com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAML>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: in 'reader', line 61, column 8:*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: - name: xpack.ml.enabled*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: ^*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at [Source: (sun.nio.ch.ChannelInputStream); line: 61, column: 8]*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.MarkedYAML>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLP>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.common.xcontent.json.JsonXContentParser.nextTo>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.common.settings.Settings.fromXContent(Settings>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.common.settings.Settings.fromXContent(Settings>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.common.settings.Settings.access$400(Settings.j>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.elasticsearch.common.settings.Settings$Builder.loadFromStrea>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: ... 9 more*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: Caused by: mapping values are not allowed here*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: in 'reader', line 61, column 8:*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: - name: xpack.ml.enabled*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: ^*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.scanner.ScannerImpl.fetchValue(ScannerImpl.ja>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerIm>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.ja>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produc>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:1>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:16>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLP>*
*Jun 06 19:08:23 keyhole systemd-entrypoint[5695]: ... 14 more*
*Jun 06 19:08:23 keyhole systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE*
*Jun 06 19:08:23 keyhole systemd[1]: elasticsearch.service: Failed with result 'exit-code'.*

```

Regards,

Uli

---

<div class="post-metadata">

**Author:** ![Coinology](https://avatars.discourse-cdn.com/v4/letter/c/3e96dc/32.png) [@Coinology](https://discuss.elastic.co/u/Coinology)\
**Post date:** [June 6, 2020, 5:42pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/12 "2020-06-06T17:42:07Z")

</div>

@uek those errors appear to be related to your YAML. The YAML you posted at [https://pastebin.com/m4P5f5qy](https://pastebin.com/m4P5f5qy) has invalid values on lines 61 & 62. You took care of that setting on line 99. Try removing those lines and let us know the result.

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 5:49pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/13 "2020-06-06T17:49:43Z")

</div>

Hi, thanks a lot I will do and tell you about the result.

Regards,

Uli

---

<div class="post-metadata">

**Author:** ![uek](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@uek](https://discuss.elastic.co/u/uek)\
**Post date:** [June 6, 2020, 9:07pm UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/14 "2020-06-06T21:07:29Z")

</div>

Problem solved!

Many thanks to [Coinology](https://discuss.elastic.co/u/Coinology)[Joshua Jones](https://discuss.elastic.co/u/Coinology)

the /etc/systemd/system/elasticsearch.service.d/override.conf

file containing these lines:

```
*[Service]*
*LimitMEMLOCK=infinity*

*& putting this option *

**`xpack.ml.enabled: false`* o*n top of the elasticsearch.yml file made it
```

---

<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:** [November 4, 2022, 8:01am UTC](https://discuss.elastic.co/t/cannot-start-elasticsearch-on-centos8/235961/15 "2022-11-04T08:01:20Z")

</div>


