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

I'm currently trying to install ES on an RPi 4B. I've used this thread as a sort of guide.

Here are the steps I've taken:

sudo apt-get install default-jre

sudo nano /etc/profile

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::") export PATH=$JAVA_HOME/bin:$PATH

Those two entries were added to the end of the file.

sudo reboot

cd Downloads

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-no-jdk-amd64.deb sudo dpkg -i --force-all --ignore-depends=libc6 elasticsearch-7.4.0-no-jdk-amd64.deb

At this point, ES appears to install, but I get this message during install:

could not find java in JAVA_HOME or bundled at /usr/share/elasticsearch/jdk/bin/java

I then try and modify the elasticsearch config file, specifically the JAVA_HOME entry from this thread with the following command:

sudo nano /etc/default/elasticsearch

# Elasticsearch Java path
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf

It appears though that the service still will not start. This is the service status:

pi@raspberrypi:~/Downloads $ sudo systemctl status elasticsearch.service

● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-10-07 15:10:34 PDT; 9s ago
Docs: http://www.elastic.co
Process: 5880 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, stat
Main PID: 5880 (code=exited, status=1/FAILURE)

Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.jav
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAw
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.cli.Command.main(Command.java:90)
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:1
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:9
Oct 07 15:10:33 raspberrypi elasticsearch[5880]: Refer to the log for complete error details.
Oct 07 15:10:34 raspberrypi systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Oct 07 15:10:34 raspberrypi systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Oct 07 15:10:34 raspberrypi systemd[1]: Failed to start Elasticsearch.

Does anyone know how to get this working? Or is there a specific configuration issue that jumps out? Any help i can get on this is much appreciated. Thank you.

Hi @glassman,

I think you need to check the elasticsearch log for more details on why ES is failing to start.

Hope this helps.

Hello @glassman,
have you installed elasticsearch on Raspberry pi 4 ? Can you tell me the steps how you do it ?
Greetings
micky1067

Can you give some more details?
What's the package called and what repository is in?

Thank you!

1 Like

@finbarr996 I made a mistake. It turns out that the aptitude package for the RPi is really old.

However I do have some new info regarding my original post and it turns out that the post is a little too long, so I'll have to break it up into two posts.

@Yogesh_Gaikwad It's been a long journey, and I'm not quite done, but I did some digging and this is what I found.

I used journalctl to check the elasticsearch service and what I first found is that is that there were permissions issues with /etc/elasticsearch.

pi@raspberrypi : ~ $ journalctl --unit elasticsearch

-- Logs begin at Tue 2019-10-08 01:35:02 PDT, end at Tue 2019-10-08 01:50:42 PDT. --
Oct 08 01:35:10 raspberrypi systemd[1]: Starting Elasticsearch...
Oct 08 01:35:36 raspberrypi elasticsearch[830]: OpenJDK Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Oct 08 01:36:28 raspberrypi elasticsearch[830]: Exception in thread "main" org.elasticsearch.bootstrap.BootstrapException: org.elasticsearch.cli.UserException: unable to create temporary keystore at [/etc/elasticsearch/elasticsearch.k
Oct 08 01:36:28 raspberrypi elasticsearch[830]: Likely root cause: java.nio.file.AccessDeniedException: /etc/elasticsearch/elasticsearch.keystore.tmp
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:215)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at java.base/java.nio.file.Files.newOutputStream(Files.java:219)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:410)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:406)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:254)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.common.settings.KeyStoreWrapper.save(KeyStoreWrapper.java:484)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Bootstrap.loadSecureSettings(Bootstrap.java:242)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:305)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.cli.Command.main(Command.java:90)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Oct 08 01:36:28 raspberrypi elasticsearch[830]: Refer to the log for complete error details.
Oct 08 01:36:29 raspberrypi systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Oct 08 01:36:29 raspberrypi systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

After viewing that I attempted to change permissions:

pi@raspberrypi : ~ $ sudo chmod g+w /etc/elasticsearch

This was an improvement as there were no keystore errors. However, elasticsearch still would not start:

pi@raspberrypi : ~ $ journalctl --unit elasticsearch

Oct 08 01:43:47 raspberrypi systemd[1]: Starting Elasticsearch...
Oct 08 01:43:52 raspberrypi elasticsearch[2571]: OpenJDK Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Oct 08 01:44:43 raspberrypi systemd[1]: **elasticsearch.service: Main process exited, code=exited, status=1/FAILURE**
Oct 08 01:44:43 raspberrypi systemd[1]: **elasticsearch.service: Failed with result 'exit-code'.**
Oct 08 01:44:43 raspberrypi systemd[1]: **Failed to start Elasticsearch.**

I wanted to see if I could create a key myself so I iissued the following command and was met with an error:

pi@raspberrypi : ~ $ sudo -u elasticsearch -s /usr/share/elasticsearch/bin/elasticsearch-keystore create

could not find java in JAVA_HOME or bundled at /usr/share/elasticsearch/jdk/bin/java

This was odd to me as i already have JAVA_HOME defined. As a test I placed my Java files inside the elasticsearch jdk directory:

pi@raspberrypi : ~ $ sudo mkdir -p /usr/share/elasticsearch/jdk

pi@raspberrypi : ~ $ sudo cp -rf /usr/lib/jvm/java-11-openjdk-armhf/* /usr/share/elasticsearch/jdk

I then attempted again to create a key but stopped short when I realized the command would work:

pi@raspberrypi : ~ $ sudo -u elasticsearch -s /usr/share/elasticsearch/bin/elasticsearch-keystore create

An elasticsearch keystore already exists. Overwrite? [y/N]n
Exiting without creating keystore.

Continued ...

1 Like

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

David,
Some very cool work here, and hopefully this will help me get a little further forward too.
I'm going to rebuild my Pi tonight and see how far I can get and then perhaps we can try to get this working between us.

Thank you for posting so much detail - it's really helpful!
Cheers,
John.

Thanks @finbarr996. Hopefully you can figure out what I'm currently struggling with.

Well, I can definitively say that this is a problem with 7.4.0 on the Pi and not 7.3.2. With 7.4.0, like I posted above, there seems to be some sort of Java issue. I even tried compiling and using the JDK from here, but the log yielded different errors that I hadn't seen:

[2019-10-09T09:23:14,422][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [raspberrypi] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.xpack.core.XPackPlugin]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[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]
Caused by: java.lang.IllegalStateException: failed to load plugin class [org.elasticsearch.xpack.core.XPackPlugin]
at org.elasticsearch.plugins.PluginsService.loadPlugin(PluginsService.java:614) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.plugins.PluginsService.loadBundle(PluginsService.java:556) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.plugins.PluginsService.loadBundles(PluginsService.java:471) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:163) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.node.Node.<init>(Node.java:311) ~[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]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:221) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:221) ~[elasticsearch-7.4.0.jar:7.4.0]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[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]
... 6 more

This was only a snippet of the log as most of it went on the same way.

I did not experience these errors with a clean install of 7.3.2. Here are the commands I used to install and run ES 7.3.2 in chronological order:

sudo apt-get install default-jre apt-transport-https

sudo mkdir -p /usr/share/elasticsearch/jdk

sudo cp -rf /usr/lib/jvm/java-11-openjdk-armhf/* /usr/share/elasticsearch/jdk

cd ~/Downloads

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-no-jdk-amd64.deb

sudo dpkg -i --force-all --ignore-depends=libc6 elasticsearch-7.4.0-no-jdk-amd64.deb

echo 'xpack.ml.enabled: false' | sudo tee -a /etc/elasticsearch/elasticsearch.yml

sudo systemctl enable elasticsearch

sudo systemctl start elasticsearch

Here is the service running afterwards:

pi@raspberrypi:~ $ sudo systemctl status elasticsearch.service

● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2019-10-09 02:07:06 PDT; 4s ago
Docs: http://www.elastic.co
Main PID: 1544 (java)
Tasks: 3 (limit: 4915)
Memory: 154.5M
CGroup: /system.slice/elasticsearch.service
└─1544 /usr/share/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative

As shown, it's a lot simpler to install and get 7.3.2 running, but I'm at a loss as to why 7.4.0 will not run using the same procedures. Again, I'm at the mercy of the community, and I look forward to hearing from anyone willing to help.

Someone will likely tell me that "omg, dropping a jna file into the lib folder isn't supported!!!", but this is the only way I have been been able to get elasticsearch 7.4.0 on the Raspberry Pi operational. Anyway, I hope this helps.

Use the following commands to install Bellsoft OpenJRE 11:

wget https://download.bell-sw.com/java/11.0.5+11/bellsoft-jre11.0.5+11-linux-arm32-vfp-hflt.deb
sudo dpkg -i bellsoft-jre11.0.5+11-linux-arm32-vfp-hflt.deb

Now we're going to take the JRE that we installed and pre-game by copying it into a directory that the elasticsearch installer will recognize. This makes it so the installer completes all tasks (including the creation of the keystore) successfully. Then we proceed to install elasticsearch:

sudo mkdir -p /usr/share/elasticsearch/jdk
sudo cp -rf /usr/lib/jvm/bellsoft-java11-arm32-vfp-hflt/* /usr/share/elasticsearch/jdk
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-no-jdk-amd64.deb
sudo dpkg -i --force-all --ignore-depends=libc6 elasticsearch-7.4.0-no-jdk-amd64.deb

Because we installed a deb package by ignoring a dependency, any time you try to update/install software with the aptitude installer it will now insist you that you first fix missing dependencies by removing elasticsearch (bad). To fix this, you need to edit the dpkg status file with "sudo nano /var/lib/dpkg/status" and do a search for elasticsearch.

This should bring you to a section that looks like this:

Package: elasticsearch
Status: install ok installed
Priority: optional
Section: web
Installed-Size: 198434
Maintainer: Elasticsearch Team info@elastic.co
Architecture: amd64
Source: elasticsearch
Version: 7.4.0
Depends: bash (>= 4.1), lsb-base (>= 4), libc6, adduser, coreutils (>= 8.4)

What you want to do here is remove the libc6 dependency from the "Depends" line (last line). Afterwards, save and exit the file by pressing CTRL X, then press Y when prompted, and then Enter.

The next two commands are where the JNA magic happens:

sudo mv /usr/share/elasticsearch/lib/jna-4.5.1.jar /usr/share/elasticsearch/lib/jna-4.5.1.jar.old
sudo wget -P /usr/share/elasticsearch/lib http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.5.1/jna-4.5.1.jar

The fact that I had to use a different jna.jar file is interesting, and a little perplexing. Additionally, it seems that something about the way the elasticsearch service starts changed quite a bit from 7.3.2 to 7.4.0. In 7.3.2 JNA didn't seem to matter because the log would show the service starting with JNA options disabled, and although the 7.4.0 log reflects the same JNA options disabled as in 7.3.2, unless the jna-4.5.1.jar file is replaced, the 7.4.0 service never starts. I suspect that JNA is required now, but the logs aren't quite reflecting that. Additionally, this is also causing elasticsearch to take a much longer time to successfully start as a service. Moving on ...

Now we will append some options to the end of the elasticsearch.yml file to disable machine learning (necessary) and SecComp:

echo 'xpack.ml.enabled: false' | sudo tee -a /etc/elasticsearch/elasticsearch.yml
echo 'bootstrap.system_call_filter: false' | sudo tee -a /etc/elasticsearch/elasticsearch.yml

Note that disabling SecComp isn't completely necessary as the service will start, but the log will complain about it with the following:

[WARN ][o.e.b.JNANatives ] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed

The last two commands are pretty self explanatory:

sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

4 Likes

Hi @glassman,

I see you got it working, thanks for posting the solution.
I am not sure if Balena OS would be helpful for you that I came across as that allows you to run docker containers.


And maybe ES containers could also run on them and something that might help in your project.

Regards,
Yogesh Gaikwad

@Yogesh_Gaikwad That's something we looked into, and it could work, except this was a rather large project and we wanted to keep the OS as standard as we could as we were guaranteed to run into compatibility issues. Ubuntu/Debian has a lot of support.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.