DineshNaik
(Dinesh Kumar Naik)
June 6, 2022, 11:38am
3
Looks like some permission issue
See if below links help :
opened 01:41PM - 17 May 16 UTC
closed 10:57AM - 21 Nov 16 UTC
feedback_needed
:Delivery/Packaging
Team:Delivery
**Elasticsearch version**: 2.3.2
**JVM version**: java version "1.8.0_45"
Java… (TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
**OS version**: Centos 7 SELinux enabled
**Description of the problem including expected versus actual behavior**:
We have hardened Centos 7 where /tmp is not writeable
We have elasticsearch homedir in custom location and we link that custom location into /var/lib/elasticsearch.
We define tmp dir path in /etc/sysconfig/elasticserach as
# Additional Java OPTS
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp" (we also tried without "" and with java.io.tmpdir=)
**Steps to reproduce**:
1. change tmpdir path in sysconfig
2. restart application
**Provide logs (if relevant)**:
`[2016-05-17 12:31:30,875][WARN ][bootstrap ] unable to load JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: /tmp/jna--1985354563/jna306419785920339930.tmp: /tmp/jna--1985354563/jna306419785920339930.tmp: failed to map segment from shared object: Operation not permitted
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:761)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:736)
at com.sun.jna.Native.<clinit>(Native.java:131)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.elasticsearch.bootstrap.Natives.<clinit>(Natives.java:45)
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:89)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)`
[elasticsearch_dump.txt](https://github.com/elastic/elasticsearch/files/268267/elasticsearch_dump.txt)
opened 10:10AM - 30 Aug 21 UTC
closed 08:18AM - 15 Nov 21 UTC
>enhancement
stalled
:Delivery/Packaging
Team:Delivery
JNA requires a temporary directory which is not mounted `noexec`, but JNA also u… ses `libffi` which itself requires a temporary directory that isn't mounted `noexec`. If none of the usual suspects work, [`libffi` will fall back to `$HOME`](https://github.com/libffi/libffi/blob/ee1263f7d43bd29b15fc72c4d9520a824e8004df/src/closures.c#L702-L707) which will often work, but in general might also not permit executables (or even exist).
We override the temporary directory that JNA uses by setting the `java.io.tmpdir` system property to `ES_TMPDIR`. I believe we should do the same thing for `libffi`, by setting the `LIBFFI_TMPDIR` environment variable. We should also document that this can be overridden much as we do for the `jna.tmpdir` system property (which trumps `java.io.tmpdir` if set).
Fixing this would, I believe, also fix #73309.
1 Like