# Starting Elasticsearch with systemd hangs

**URL:** <https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510>\
**Category:** Elasticsearch\
**Created:** [April 23, 2020, 3:57pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510 "2020-04-23T15:57:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [April 23, 2020, 3:57pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510/1 "2020-04-23T15:57:32Z")

</div>

Hello,

I'm having trouble trying to start Elasticsearh (tar.gz installation) with Systemd.

This is the service's unit file. I copyied from Elastic's repo in Github and changed user, group and path variables. Other than that I already added the `TimeoutStartSec=900` parameter, trying to solve this.

What happens is that `systemctl start elasticsearch` hangs... When I try to see the logs looks like it's stuck in:

```auto
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

```

And then it times out.

Unit file:

```auto
[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target

[Service]
Type=notify
TimeoutStartSec=900
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME=/u/elastic/elasticsearch
Environment=ES_PATH_CONF=/u/elastic/elasticsearch/config
Environment=PID_DIR=/var/run/elasticsearch
Environment=ES_SD_NOTIFY=true

WorkingDirectory=/u/elastic/elasticsearch

User=elastic
Group=elastic

ExecStart=/u/elastic/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet

# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit

# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535

# Specifies the maximum number of processes
LimitNPROC=4096

# Specifies the maximum size of virtual memory
LimitAS=infinity

# Specifies the maximum file size
LimitFSIZE=infinity

# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0

# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM

# Send the signal only to the JVM rather than its control group
KillMode=process

# Java process is never killed
SendSIGKILL=no

# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

# Built for ${project.name}-${project.version} (${project.name})

```

Any clue? I suppose Systemd is waiting to be notified by the processe, but that doesn't happen somehow.

By the way, when I start manually it works.

Thank you!

---

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [April 23, 2020, 7:23pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510/2 "2020-04-23T19:23:34Z")

</div>

Found this one. SHould be helpful for someone, but it didn't work for me.

> [@Elasticsearch no longer works under systemd (7.4.0 on CentOS 7.7.1908)?](https://discuss.elastic.co/t/elasticsearch-no-longer-works-under-systemd-7-4-0-on-centos-7-7-1908/201846):
>
> I'm at a loss here. I have a WHM-managed CentOS 7.7 that's regularly applying patches in the background. I did a reboot today to have a kernel update take effect and when the system came back up ElasticSearch failed to start. I'm running the latest ES package that's available according to yum on my machine: # yum info elasticsearch Loaded plugins: langpacks, universal-hooks Installed Packages Name : elasticsearch Arch : x86\_64 Version : 7.4.0 Release : 1 Size : 469…

---

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [April 23, 2020, 7:34pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510/3 "2020-04-23T19:34:46Z")

</div>

In my case, qhen I removed the `--quiet`` from the start line of the unit, I can see with `journalctl -f -u elasticsearch` that Elasticsearch is up and running, quite fast...

But It doesn't seen to notify systemd. So my prompt keeps stuck.

---

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [April 23, 2020, 7:46pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510/4 "2020-04-23T19:46:36Z")

</div>

So, I found the explanation for this... (by the way, I installed elasticsearch from tar.gz)

> <https://github.com/elastic/elasticsearch/issues/55477>
>
> Elasticsearch version: 7.6.x
> Plugins installed: none
> JVM version: OpenJDK 9
> OS version:4.15.0-76-generic
> Description of the problem including expected versus actual behavior:
> Running ES as a systemd...

> <https://github.com/elastic/elasticsearch/issues/55477#issuecomment-616740158>
>
> Elasticsearch version: 7.6.x
> Plugins installed: none
> JVM version: OpenJDK 9
> OS version:4.15.0-76-generic
> Description of the problem including expected versus actual behavior:
> Running ES as a systemd...

> <https://github.com/elastic/elasticsearch/issues/55477#issuecomment-616758741>
>
> Elasticsearch version: 7.6.x
> Plugins installed: none
> JVM version: OpenJDK 9
> OS version:4.15.0-76-generic
> Description of the problem including expected versus actual behavior:
> Running ES as a systemd...

So, just changed `Type` to `simple`.

---

<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:** [May 21, 2020, 8:00pm UTC](https://discuss.elastic.co/t/starting-elasticsearch-with-systemd-hangs/229510/5 "2020-05-21T20:00:37Z")

</div>

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