Security

Removing stale pid file... Can't unlink pid file "/opt/splunk/var/run/splunk/splunkd.pid": Permission denied

vnguyen46
Contributor

Hello,
I think there is a permission issue after my Linux system admin changed access to a directory.
Now my SH stopped. Either I run splunk status or start, I received the error message:
Removing stale pid file... Can't unlink pid file "/opt/splunk/var/run/splunk/splunkd.pid": Permission denied
My splunkd.pid file permission set as following:
-rwxrwxrwx. 1 splunk splunk 364 Apr 21 10:50 splunkd.pid

Anyone has resolved the same issue?

Thank you,

Labels (1)
0 Karma
1 Solution

PavelP
Motivator

Hello @vnguyen46,

as @renjith.nair mentioned, you have to check permission of folders.

Here are the permissions and owners of the pid file and folders of default install:

# namei -mo /opt/splunk/var/run/splunk/splunkd.pid
f: /opt/splunk/var/run/splunk/splunkd.pid
 dr-xr-xr-x root   root   /
 drwxr-xr-x root   root   opt
 drwx------ splunk splunk splunk
 drwx--x--- splunk splunk var
 drwx--x--- splunk splunk run
 drwx--x--x splunk splunk splunk
 -rw-r----- splunk splunk splunkd.pid

The permission set rwxrwxrwx (777 in octal notation) is applied usually to links and suid files only and should not be used.

View solution in original post

0 Karma

PavelP
Motivator

Hello @vnguyen46,

as @renjith.nair mentioned, you have to check permission of folders.

Here are the permissions and owners of the pid file and folders of default install:

# namei -mo /opt/splunk/var/run/splunk/splunkd.pid
f: /opt/splunk/var/run/splunk/splunkd.pid
 dr-xr-xr-x root   root   /
 drwxr-xr-x root   root   opt
 drwx------ splunk splunk splunk
 drwx--x--- splunk splunk var
 drwx--x--- splunk splunk run
 drwx--x--x splunk splunk splunk
 -rw-r----- splunk splunk splunkd.pid

The permission set rwxrwxrwx (777 in octal notation) is applied usually to links and suid files only and should not be used.

0 Karma

vnguyen46
Contributor

Thank you all. The issue was that the Linux admin renamed file splunkd.pid and assume this file would be recreated once Splunk restarted, but it didn't. Rename the file back to its original doesn't work, so this file needs to be manually recreated.

Thanks,

0 Karma

renjith_nair
Legend

@vnguyen46 ,
Make sure that the splunk user has permissions on the directory level as well.

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...