# Elasticsearch 1.6 reboot problem on ubuntu

**URL:** <https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451>\
**Category:** Elasticsearch\
**Created:** [June 11, 2015, 11:27am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451 "2015-06-11T11:27:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![arno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arno/32/623_2.png) [@arno](https://discuss.elastic.co/u/arno)\
**Post date:** [June 11, 2015, 11:27am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/1 "2015-06-11T11:27:04Z")

</div>

Hi Everyone,

Has anyone here installed the latest version of Elasticsearch on a Ubuntu? If so you might have encountered the elasticsearch PID\_DIT issue when rebooting the Ubuntu server.

The file PID file is written to this directory: /var/run/elasticsearch but it's not actually there on Linux reboot because it gets deleted by ubuntu.This was not an issue in earlier versions (or at least not in 1.3.9). Is it possible to make elasticsearch write the pid-file to another location that doesn't get cleaned up by elasticsearch?

Thanks in advance,

Arno

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 11, 2015, 12:31pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/2 "2015-06-11T12:31:04Z")

</div>

Why is it a problem that the PID file is deleted when the machine is rebooted?

---

<div class="post-metadata">

**Author:** ![Trident50](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@Trident50](https://discuss.elastic.co/u/Trident50)\
**Post date:** [June 11, 2015, 3:35pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/3 "2015-06-11T15:35:38Z")

</div>

Yes, I'm having the same problem. ES was running fine and I had to reboot the system - when I tried to restart ES I got this error:

touch: cannot touch ‘/var/run/elasticsearch/elasticsearch.pid’: No such file or directory

---

<div class="post-metadata">

**Author:** ![arno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arno/32/623_2.png) [@arno](https://discuss.elastic.co/u/arno)\
**Post date:** [June 11, 2015, 5:45pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/4 "2015-06-11T17:45:47Z")

</div>

@magnusbaeck The pid file being deleted is not the problem, it's the folder in which elasticsearch wants to store that is being deleted (/var/run/elasticsearch --\> elasticsearch folder) so when it tries to insert it there on startup, it can't do it and simply refuses to start.

@Trident50 We found a solution. Open the elasticsearch file in /etc/init.d/ and change the PID\_DIR from "/var/run/elasticsearch" to "/var/run" , now it will put the PID file there.

cheers

Arno

---

<div class="post-metadata">

**Author:** ![sriharshakappala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sriharshakappala/32/46272_2.png) [@sriharshakappala](https://discuss.elastic.co/u/sriharshakappala)\
**Post date:** [June 22, 2015, 7:59am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/5 "2015-06-22T07:59:53Z")

</div>

Elasticsearch is looking for a directory `/var/run/elasticsearch` which is not getting created by default with version 1.6

A quickfix could be just creating that directory by `cd /var/run && sudo mkdir elasticsearch`

Then restart elasticsearch by `sudo service elasticsearch restart`

---

<div class="post-metadata">

**Author:** ![john\_felipe\_urrego\_m](https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/32.png) [@john\_felipe\_urrego\_m](https://discuss.elastic.co/u/john_felipe_urrego_m)\
**Post date:** [June 22, 2015, 9:50pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/6 "2015-06-22T21:50:31Z")

</div>

But every time reboot i need do this  
Other way pls?

---

<div class="post-metadata">

**Author:** ![sriharshakappala](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sriharshakappala/32/46272_2.png) [@sriharshakappala](https://discuss.elastic.co/u/sriharshakappala)\
**Post date:** [June 23, 2015, 5:22am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/7 "2015-06-23T05:22:25Z")

</div>

Found that the solution which I have posted above won't work as the folder `/var/run/elasticsearch` itself will gets deleted on every restart. So as @arno mentioned in the above solution it is recommended to change the PID\_DIR attribute. Just follow the below instructions.

1. Go to `/etc/init.d`
2. There you can see the `elasticsearch` binary. Open the file with your favorite editor with root privileges. `sudo nano elasticsearch`
3. Change the value of PID\_DIR attribute from `/var/run/elasticsearch` to `/var/run`
4. Save the file and restart elasticsearch service. `sudo service elasticsearch restart`

You are good to go now!

---

<div class="post-metadata">

**Author:** ![Gasol](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gasol/32/3482_2.png) [@Gasol](https://discuss.elastic.co/u/Gasol)\
**Post date:** [June 26, 2015, 7:33am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/8 "2015-06-26T07:33:46Z")

</div>

My solution is different. Just find the location of mkdir command and append $PID\_DIR like following snippet

```
mkdir -p "$LOG_DIR" "$DATA_DIR" "$WORK_DIR" "$PID_DIR" && chown "$ES_USER":"$ES_GROUP" "$LOG_DIR" "$DATA_DIR" "$WORK_DIR"
```

---

<div class="post-metadata">

**Author:** ![crynut84](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/crynut84/32/3652_2.png) [@crynut84](https://discuss.elastic.co/u/crynut84)\
**Post date:** [July 10, 2015, 6:06am UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/9 "2015-07-10T06:06:22Z")

</div>

Thanks @arno

---

<div class="post-metadata">

**Author:** ![Diogenes\_Jesus](https://avatars.discourse-cdn.com/v4/letter/d/48db29/32.png) [@Diogenes\_Jesus](https://discuss.elastic.co/u/Diogenes_Jesus)\
**Post date:** [July 28, 2015, 6:41pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/10 "2015-07-28T18:41:21Z")

</div>

Was this fixed on 1.7.0?

---

<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:** [July 5, 2017, 11:58pm UTC](https://discuss.elastic.co/t/elasticsearch-1-6-reboot-problem-on-ubuntu/2451/11 "2017-07-05T23:58:33Z")

</div>


