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

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