# When restarting my machine Kibana pid file is removed automatically

**URL:** <https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686>\
**Category:** Kibana\
**Created:** [August 9, 2018, 12:28pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686 "2018-08-09T12:28:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheSmartMonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thesmartmonkey/32/33965_2.png) [@TheSmartMonkey](https://discuss.elastic.co/u/TheSmartMonkey)\
**Post date:** [August 9, 2018, 12:28pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/1 "2018-08-09T12:28:05Z")

</div>

I installed ELK version 6.3.2 on a centos 7 machine

The issue is when i restart this machine I have no more `/var/run/kibana.pid` file

Each time i restart the machine I have to do this commands :  
`touch /var/run/kibana.pid`  
`chown kibana:kibana /var/run/kibana.pid`  
`systemctl restart kibana`

Have you some solution to this issue or I have to do a script that execute when my machine boot ?

---

<div class="post-metadata">

**Author:** ![waqark3389](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waqark3389/32/34265_2.png) [@waqark3389](https://discuss.elastic.co/u/waqark3389)\
**Post date:** [August 9, 2018, 12:48pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/2 "2018-08-09T12:48:39Z")

</div>

Cloud this be because the "kibana" user is unable to create a pid file itself in the /var/run directory?

How did you install kibana?

---

<div class="post-metadata">

**Author:** ![TheSmartMonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thesmartmonkey/32/33965_2.png) [@TheSmartMonkey](https://discuss.elastic.co/u/TheSmartMonkey)\
**Post date:** [August 9, 2018, 12:59pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/3 "2018-08-09T12:59:29Z")

</div>

I installed Kibana with rpm 6.x  
The thing is I didn't got this issue on an other centos 7 machine with kibana 6.3.0

---

<div class="post-metadata">

**Author:** ![waqark3389](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waqark3389/32/34265_2.png) [@waqark3389](https://discuss.elastic.co/u/waqark3389)\
**Post date:** [August 9, 2018, 1:05pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/4 "2018-08-09T13:05:45Z")

</div>

Is selinux enabled? What does the kibana log show upon trying to start the service exactly? The issue is a permissions one because it is able to delete the file on shutdown before restarting as it owns it

---

<div class="post-metadata">

**Author:** ![TheSmartMonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thesmartmonkey/32/33965_2.png) [@TheSmartMonkey](https://discuss.elastic.co/u/TheSmartMonkey)\
**Post date:** [August 9, 2018, 1:12pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/5 "2018-08-09T13:12:28Z")

</div>

Yes SELinux is enabled  
I have this error in my logs :

```
FATAL { Error: EACCES: permission denied, open '/var/run/kibana.pid'
  cause: 
   { Error: EACCES: permission denied, open '/var/run/kibana.pid'
     errno: -13,
     code: 'EACCES',
     syscall: 'open',
     path: '/var/run/kibana.pid' },
  isOperational: true,
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/var/run/kibana.pid' }

```

I think your right but how to change it

---

<div class="post-metadata">

**Author:** ![waqark3389](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/waqark3389/32/34265_2.png) [@waqark3389](https://discuss.elastic.co/u/waqark3389)\
**Post date:** [August 9, 2018, 1:36pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/6 "2018-08-09T13:36:16Z")

</div>

How do you start it? I have an init.d file and this file creates the pid file as owned by root. So something is done differently here 🙂

---

<div class="post-metadata">

**Author:** ![TheSmartMonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thesmartmonkey/32/33965_2.png) [@TheSmartMonkey](https://discuss.elastic.co/u/TheSmartMonkey)\
**Post date:** [August 13, 2018, 12:23pm UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/7 "2018-08-13T12:23:30Z")

</div>

Sorry for my late answer i search for this issue and i found topics related to this but had normally been fix : [https://github.com/elastic/kibana/issues/7759](https://github.com/elastic/kibana/issues/7759) and [https://github.com/elastic/kibana/issues/12055](https://github.com/elastic/kibana/issues/12055)

My initial conf at `/etc/systemd/system/kibana.service` :

```
[Unit]
Description=Kibana

[Service]
Type=simple
User=kibana
Group=kibana
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/kibana
EnvironmentFile=-/etc/sysconfig/kibana
ExecStart=/usr/share/kibana/bin/kibana "-c /etc/kibana/kibana.yml"
Restart=always
WorkingDirectory=/

[Install]
WantedBy=multi-user.target

```

I tried to add a kibana directory and add the two ExecStartPre lines but nothing to do it don't works

---

<div class="post-metadata">

**Author:** ![TheSmartMonkey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thesmartmonkey/32/33965_2.png) [@TheSmartMonkey](https://discuss.elastic.co/u/TheSmartMonkey)\
**Post date:** [August 14, 2018, 11:22am UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/8 "2018-08-14T11:22:34Z")

</div>

Lot of search for nothing I just removed the `pid.file: /var/run/kibana.pid` from the kibana conf `/etc/kibana/kibana.yml` and no more problem ^^ don't know why

---

<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:** [September 11, 2018, 11:22am UTC](https://discuss.elastic.co/t/when-restarting-my-machine-kibana-pid-file-is-removed-automatically/143686/9 "2018-09-11T11:22:43Z")

</div>

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