| 12345678910111213141516171819202122232425262728293031323334353637 | [[executable-jna-tmpdir]]=== JNA temporary directory not mounted with `noexec`[NOTE]This is only relevant for Linux.{es} uses the Java Native Access (JNA) library, and another library called`libffi`, for executing some platform-dependent native code. On Linux, thenative code backing these libraries is extracted at runtime into a temporarydirectory and then mapped into executable pages in {es}'s address space. Thisrequires the underlying files not to be on a filesystem mounted with the`noexec` option.By default, {es} will create its temporary directory within `/tmp`. However,some hardened Linux installations mount `/tmp` with the `noexec` option bydefault. This prevents JNA and `libffi` from working correctly. For instance,at startup JNA may fail to load with an `java.lang.UnsatisfiedLinkerError`exception or with a message that says something similar to`failed to map segment from shared object`. Note that the exception message candiffer amongst JVM versions. Additionally, the components of {es} that rely onexecution of native code via JNA may fail with messages indicating that it is`because JNA is not available`.To resolve these problems, either remove the `noexec` option from your `/tmp`filesystem, or configure {es} to use a different location for its temporarydirectory by setting the <<es-tmpdir,`$ES_TMPDIR`>> environment variable. Forinstance:["source","sh",subs="attributes"]--------------------------------------------export ES_TMPDIR=/usr/share/elasticsearch/tmp--------------------------------------------Alternatively, you can configure the path that JNA uses for its temporary fileswith the <<set-jvm-options,JVM flag>> `-Djna.tmpdir=<path>` and you canconfigure the path that `libffi` uses for its temporary files with the`LIBFFI_TMPDIR` environment variable.
 |