Installing Elasticsearch 7.4 on a Raspberry Pi 4 (Raspbian Buster)

Even after all this, the service still would not start. I now turned my attention to the elasticsearch.log located in /var/log/elasticsearch. There was an entry regarding an unsupported X-Pack:

[2019-10-08T02:14:13,852][ERROR][o.e.b.Bootstrap ] [raspberrypi] Exception
org.elasticsearch.ElasticsearchException: X-Pack is not supported and Machine Learning is not available for [linux-arm]; you can use the other X-Pack features (unsupported) by setting xpack.ml.enabled: false in elasticsearch.yml
at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:109) ~[?:?]
at org.elasticsearch.xpack.ml.MachineLearningFeatureSet.isRunningOnMlPlatform(MachineLearningFeatureSet.java:100) ~[?:?]
at org.elasticsearch.xpack.ml.MachineLearning.createComponents(MachineLearning.java:499) ~[?:?]
at org.elasticsearch.node.Node.lambda$new$9(Node.java:450) ~[elasticsearch-7.4.0.jar:7.4.0]
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271) ~[?:?]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1654) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
at org.elasticsearch.node.Node.<init>(Node.java:453) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.node.Node.<init>(Node.java:255) ~[elasticsearch-7.4.0.jar:7.4.0]

I wasn't sure if this would stop the service from starting, but I disabled it anyway with the following:

pi@raspberrypi : ~ $ sudo nano /etc/elasticsearch/elasticsearch.yml

xpack.ml.enabled: false

I then tried to start the elasticsearch service again. It failed. When I checked the elasticsearch log, it now mentioned a fatal error about not being able to initialize class com.sun.jna.native:

[2019-10-08T02:20:22,875][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [raspberrypi] fatal error in thread [main], exiting
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:66) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:74) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1540) ~[?:?]
at org.elasticsearch.node.Node.start(Node.java:768) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:273) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.4.0.jar:7.4.0]

I read in another discussion how this is usually in regard to the /tmp directory being mounted with noexec. In my case, the tmp directory isn't mounted, it's just a directory. Nevertheless, I decided to change where the tmp directory is located, change the permissions, and then add it to the systemd service:

pi@raspberrypi : ~ $ sudo nano /etc/default/elasticsearch

# Elasticsearch tmp directory
ES_TMPDIR=/usr/share/elasticsearch/tmp

pi@raspberrypi : ~ $ sudo mkdir /usr/share/elasticsearch/tmp && sudo chmod 777 -R /usr/share/elasticsearch/tmp

pi@raspberrypi : ~ $ systemctl edit --full elasticsearch.service

[service]
Environment=ES_TMPDIR=/usr/share/elasticsearch/tmp

This is where I'm stuck as it appear to have had no effect:

[2019-10-08T02:57:41,527][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [raspberrypi] fatal error in thread [main], exiting
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:66) ~[?:?]
at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:74) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1540) ~[?:?]
at org.elasticsearch.node.Node.start(Node.java:768) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:273) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.4.0.jar:7.4.0]

I know this is a lot, but I tried to be as clear and concise as possible. If there's anything that anyone knows that may be helpful, I would love to hear it. I've tried my best with the limited skillset I have in this area, and I will continue to try, but it would be a major boon to have anyone help where they could. Thank you, and I look forward to hearing from the community members here!

2 Likes