Unable to load JNA native support library Elasticsearch 6.x
- Go to
/etc/sysconfig/elasticsearch
Add
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
.(For newer Elasticsearch, use
Djava.io.tmpdir
instead ofDjna.tmpdir
)- Start Elasticsearch using
systemctl start elasticsearch
orservice start elasticsearch
. - You can see now
tmp
folder created inside/var/lib/elasticsearch/
. - This folder should have execute permission for
elasticsearch
user - Check the permission with name
i -l /var/lib/elasticsearch
Make sure the permission file have something like below permission
dr-xr-xr-x root root /drwxr-xr-x root root vardrwxr-xr-x root root libdrwxr-x--- elasticsearch elasticsearch elasticsearch
I hope your issue will be resolved.
I had the same issue on a CentOS7 cPanel server with ElasticSearch 7.8 installed via YUM.As per the answer, I did the following:
- Set
ES_JAVA_OPTS="-Djna.tmpdir=/var/lib/elasticsearch/tmp"
in/etc/sysconfig/elasticsearch
mkdir -p /var/lib/elasticsearch/tmp
chown -R elasticsearch.elasticsearch /var/lib/elasticsearch/tmp
Check the permissions on your /tmp/
directory. It must have had noexec
.
/tmp
needs exec
to support JNA. A workaround is to specify a tmp
directory in elasticsearch sysconfig file.
Something like export JAVA_OPTS="-Djava.io.tmpdir=$ES_HOME/tmp"
Make sure there is a $ES_HOME/tmp
directory and elasticsearch
user has write permissions to it.
I had this issue as I was using a hardened OS and also because the default umask is 0027
.