-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
elasticsearch fails to start when tmp directory defined #18406
Comments
I tried setting the tmpdir with
Do you mean symlinked? That's probably your problem. |
Yeah i mean we have a symlink.
I have tried without a symlink fails the same way Have you checked the kernel dump i've attached to the original post? |
Looks like a duplicate of #18406 Closing |
You closed this with reference to itself. :-) |
Whoops. Reopening. @jasontedor any thoughts? |
This looks similar to #18272 |
Thanks! sounds like the right thing. Not sure why google liked the duplicate better. In summary that bug says:
|
I think my last comment was lost. Sounds you found the right reference. |
Reclosing in favour of #18272 |
This is false. It's not clear exactly what the poor interaction is because no one can provide a clear reproduction, but it does run fine on some systems with SELinux set to enforcing and
This is false. We have CI machines, VMs for our packaging tests, and my workstation (and likely other developer's workstations) that all run SELinux in enforcing mode. |
Yes, until someone can provide a 100% reliable reproduction. |
It does seem to be related to the noexec mount options. I've had the same issue on 1 of our servers. When the noexec mount option is active on the /tmp directory, I get this error:
After that I removed the noexec mount option, and it works fine. |
Just chiming in here to say we have the same problem. We use ES: elasticsearch-5.2.0-1.noarch (RPM distribution)
|
@jasontedor Reproduction was quite simple for me. Place noexec mount options on /tmp, installations fails. Even if a seperate tmp dir is defined (it is not respected or used). Remove noexec mount options, installation works fine. |
@Fabian1976 @jcmcken Can you please share more about your OS, versions of elasticsearch and java, @jcmcken Do the other applications you mentioned also use JNA? Also, I can't reproduce on a fresh CentOS installation (see above) with
|
@Fabian1976 I know that this thread is quite long, but the stack trace that you provided is different than the one that triggered this issue. I think that we are looking at separate problems. It might be best if you open a separate issue. |
@tlrx did you look in your elasticsearch logs too or just run the tests? |
@tlrx
Elasticsearch version:
Java version:
Proc mounts:
FStab:
|
Just to be clear, because I'm not sure we're talking about the same thing: ES launches just fine when The issue is that it's falling back to NOT using JNA in this configuration, which you can see by examining the logs. But I would like to actually use whatever native extensions are available. And so I'm setting Jenkins CI is the example that comes to mind where we're setting |
I am also hitting the same error when we try to define separate TMP folder for elasticsearch with similar configurations. |
Try this: The problem can be solved download jars, and copy to elasticsearch lib folder https://github.com/java-native-access/jna Version 4.4.0 |
@candido1212 Elasticsearch 5.4.0 ships with JNA 4.4.0 now. Dropping jars into the lib folder is fully unsupported. |
@candido1212 were you doing that on ES 5.4.0? |
@jasontedor |
I have the same issue - tried what candido suggested but without success.
after that:
|
@yami12376 As I mentioned, dropping jars in the lib folder is fully unsupported. The problem that you're running to here is that the official JNA jar from upstream does not support older distributions that do not support newer versions of glibc. This is why we ship with our own build of JNA that does support some of the older distributions that we still support. The only difference between our build and upstream is that the Linux native library is recompiled to support OS that are using older versions of glibc, everything else is identical to upstream so dropping a different version of the jar in the lib folder is not going to help with anything to begin with. Please, stop following the advice to drop a different build into the lib folder. It is not a solution to the problem here, and it is fully unsupported. |
I updated to CentOs 7 - and it works fine |
I'm currently running ES 2.4.0 running on CentOS 6.6 (PPC) and am haveing some of the same issues after our SA's have done some upgrades to the systems. I can't get past the "because JNA is not available" and ES won't use ES_JAVA_OPTS to point to a different jna.tmpdir. Also /tmp doesn't have the noexec option turned on and still won't start up after the system upgrade. |
Do we have a solution to this issue. I am using ES ( version 5.6) now and I have hit the same issue. Same platform, if I was using my previous installed ES ( version 2.4), I don't have this problem. Thanks. |
I encountered this issue on 5.3.3-1 on RHEL 7.4 when relocating multiple ES directories. I was modifying jvm.options to add -Djava.io.tmpdir=... with a custom directory. I eventually solved it when I realized that the system still uses /etc/elasticsearch/jvm.options on RHEL7 even if you relocate default.path.conf. I was modifying copies of jvm.options in my new configuration directories at first. |
In 5.x you can set |
I got around this in a Spring Boot application running on RHEL6 by setting -Djava.io.tmpdir to an alternative temporary folder with exec permissions in the startup script for the spring boot application that bundles ES. |
Got the same problem on W10, running as admin solved that - https://stackoverflow.com/a/49953880/2116237 |
Wanted to note one thing on RHEL 7: We use a secure configuration that mounts /tmp as noexec With SELinux in "Permissive" mode, ES will crash unless I set bootstrap.system_call_filter: false, even if I change the ES_TMPDIR location to a directory with exec perms. Looks like the only way I could get it running was to either completely disable SELinux (not permissive) and change the tmp directory. Or set bootstrap.system_call_filter: false. |
-Djava.io.tmpdir= does not work on ubuntu16 |
Is the Ubuntu tmpdir behavior with a specific Java distribution like openjdk or all of them? |
Got the same issue. Simplest way to get the exception:
This way everything is fine:
|
Yeah, so I would wager that this is all part of the same issue with permissions on the tmpfs folder being used. It would be nice for for ES to log this condition with much more verbosity and specificity to in order to cut down on the time spent by admins in diagnosing this problem. |
@0x0badc0de That is not a reproduction of the issue at hand here. With
At the end of the day, for this issue, I don't think Elasticsearch was actually picking up the options the OP thinks they specified. This can be seen in the error message:
Note how it mentions Today we log all JVM options used to start Elasticsearch, so today it would be easier to verify whether or not that is the case. |
If someone has a reproduction of any issues related to JNA please open a new issue instead of continuing on this long and old discussion. It will be easier to start fresh with new reports. |
@jasontedor: |
This actually does happens and it can be reproduced on RHEL6.10 running Elasticsearch7.1.1 with /tmp mounted with noexec and ES_TMPDIR=/var/lib/elasticsearch/tmp on /etc/sysconfig/elasticsearch. If I remont /tmp without noexec it all work as intended. However that is a STIG requirement that cannot be omitted. |
@amancipe That does not reproduce for me.
|
its Work For Me After add |
It seems that -Djava.io.tmpdir alone is not enough to allow elasticsearch startup.
If you have issue with above path (e.g. also mounted with noexec flag) you can introduce new path that is not under
Then update /etc/sysconfig/elasticsearch file accordingly:
I think developers need to hardcode somewhere TMPDIR=$ES_TMPDIR |
This is what google returned to me and by going through comments it did not looked resolved (people actively commented after was closed since 2016). Nevertheless thanks for update and I submitted my findings at latest issue #. |
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:
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
The text was updated successfully, but these errors were encountered: