# Elasticsearch won't start on reboot

**URL:** <https://discuss.elastic.co/t/elasticsearch-wont-start-on-reboot/172228>\
**Category:** Elasticsearch\
**Created:** [March 14, 2019, 12:28am UTC](https://discuss.elastic.co/t/elasticsearch-wont-start-on-reboot/172228 "2019-03-14T00:28:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Potter](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steve_potter/32/39953_2.png) [@Steve\_Potter](https://discuss.elastic.co/u/Steve_Potter)\
**Post date:** [March 14, 2019, 12:28am UTC](https://discuss.elastic.co/t/elasticsearch-wont-start-on-reboot/172228/1 "2019-03-14T00:28:29Z")

</div>

When my CentOS 7 system boots, elasticsearch fails to start with the message  
`Failed at step RUNTIME_DIRECTORY spawning /usr/share/elasticsearch/bin/elasticsearch: File exists`  
Once the system is up, it starts fine with 'systemctl start elasticsearch'.

After much investigation, I think I found the problem

- /usr/lib/tmpfiles.d/elasticsearch.conf creates the directory /var/run/elasticsearch
- /usr/lib/systemd/system/elasticsearch.service has a RuntimeDirectory saying that it wants the directory /run/elasticsearch

Since /var/run is a symbolic link to /run, both try to create the /run/elasticsearch directory. The tmpfiles.d happens first, and the systemd startup of elasticsearch fails because the directory already exists.

If you now run 'systemctl start elasticsearch', it works fine because systemd removed the /run/elasticsearch directory when elasticsearch failed to start previously.

After removing /usr/lib/tmpfiles.d/elasticsearch.conf, elasticsearch starts up correctly on boot.

---

<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:** [April 11, 2019, 12:28am UTC](https://discuss.elastic.co/t/elasticsearch-wont-start-on-reboot/172228/2 "2019-04-11T00:28:31Z")

</div>

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