# Unable to take jstack for debian installations

**URL:** <https://discuss.elastic.co/t/unable-to-take-jstack-for-debian-installations/213554>\
**Category:** Elasticsearch\
**Created:** [January 2, 2020, 10:31am UTC](https://discuss.elastic.co/t/unable-to-take-jstack-for-debian-installations/213554 "2020-01-02T10:31:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajiv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajiv/32/47644_2.png) [@Rajiv](https://discuss.elastic.co/u/Rajiv)\
**Post date:** [January 2, 2020, 10:31am UTC](https://discuss.elastic.co/t/unable-to-take-jstack-for-debian-installations/213554/1 "2020-01-02T10:31:11Z")

</div>

Hello:

We have installed ES 6.8.3 on Ubuntu 14.04 using the debian installers. jstack commands do not work on these servers even when we run the command as elasticsearch user, like so:

```
$ sudo -u elasticsearch jstack -F 2087
Attaching to process ID 2087, please wait...
ERROR: ptrace(PTRACE_ATTACH, ..) failed for 2087: Operation not permitted
Error attaching to process: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 2087: Operation not permitted
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: Can't attach to the process: ptrace(PTRACE_ATTACH, ..) failed for 2087: Operation not permitted

```

jps and jstack commands work fine if we comment out the line `PrivateTmp=true` from `/usr/lib/systemd/system/elasticsearch.service` and restart the service

The `PrivateTmp=true` option was added as part of [#32615](https://github.com/elastic/elasticsearch/pull/32615/files#diff-b59b49b202289d345b3134113aa01d01R9).

Is there a recommended way to run jstack for debian installations?

---

<div class="post-metadata">

**Author:** ![Rajiv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajiv/32/47644_2.png) [@Rajiv](https://discuss.elastic.co/u/Rajiv)\
**Post date:** [January 2, 2020, 10:48am UTC](https://discuss.elastic.co/t/unable-to-take-jstack-for-debian-installations/213554/2 "2020-01-02T10:48:17Z")

</div>

Using `nsenter` to run jstack in the namespace of elasticsearch works.  
Like so:

```auto
$sudo nsenter -t 2087 -m sudo -u elasticsearch jstack 2087

```

via: [Wikitech page](https://wikitech.wikimedia.org/wiki/Search#Using_jstack_or_jmap_or_other_similar_tools_to_view_logs) at Wikimedia

---

<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:** [January 30, 2020, 10:48am UTC](https://discuss.elastic.co/t/unable-to-take-jstack-for-debian-installations/213554/3 "2020-01-30T10:48:20Z")

</div>

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