Elasticsearch.service failing on Debian

My operating system is Debian 11 (Bullseye), it runs on a Pentium E5800

I've installed JDK/Java 11 (and set the path), apt-transport-https, the Elasticsearch keys and repo, and have updated my system multiple times. I've also tried rebooting the machines, but I have had no luck.

I'm able to start elasticsearch.service, but after ~30 seconds it always fails. When I look at the service status, I see the following log:

root@debian11:~# sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-07-11 21:16:36 EDT; 44s ago
       Docs: http://www.elastic.co
    Process: 983 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
   Main PID: 983 (code=exited, status=1/FAILURE)
        CPU: 30.973s

Jul 11 21:16:15 freedom systemd[1]: Started Elasticsearch.
Jul 11 21:16:17 freedom elasticsearch[983]: OpenJDK Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Jul 11 21:16:17 freedom elasticsearch[983]: OpenJDK Server VM warning: UseAVX=2 is not supported on this CPU, setting it to UseAVX=0
Jul 11 21:16:36 freedom systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Jul 11 21:16:36 freedom systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
Jul 11 21:16:36 freedom systemd[1]: elasticsearch.service: Consumed 30.973s CPU time.

Here are the contents of "/var/lib/elasticsearch/my-elasticsearch.log", it should be noted that "my-elasticsearch" is the clustername: https://pastebin.com/Vfun3s92

Please let me know your thoughts on this.

Edit: Edit: I also attempted to uninstall and reinstall it, but with no luck. I initially installed version 6.x, but then I installed 8.x. Here's what I used for instructions: How To Install And Setup Elasticsearch Engine On Linux - YouTube

Hi @kamie Welcome to the community.

Couple things...

That is probably one of the issues... If you actually installed 6.8 started it then 8.0 on top of it that is probably the issue..

Unless your purged / manually cleaned up all the directories then the install you can't install 8.0 directly over 6.8.

So you will need to do that ... Completely clean up clean up all the directories see here

2nd I would recommend following our documents not a you tube video.

3rd your paste bin is empty as far as I can tell.

Much appreciated. Are there only packages for amd64, or is there anything that will work with i386?

The deb from here

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-amd64.deb

Should work on x86_64 architectures. I do not think that is your problem.

You could always just download the tar.gz in a fresh directory and try it that way... see here

Once I get to entering sudo dpkg -i elasticsearch-8.3.2-amd64.deb

It gives me this output.

dpkg: error processing archive elasticsearch-8.3.2-amd64.deb (--install):
 package architecture (amd64) does not match system (i386)
Errors were encountered while processing:
 elasticsearch-8.3.2-amd64.deb

Is it ok for me to proceed, or do I need to find another way now?

Apologies / Interesting it has been a loong time since I have see that... sorry I was not thinking / looking clearly yes, unfortunately i386 is only 32bit processor it is not x86_64 hmmm... all our releases are for 64bit now.

You could try docker but I am not sure about that either.... I think you are going to need a little bit new server.

Oddly enough, it returns i386 as it's architecture but it supports 64 bit operating systems, so I guess it's technically i398/i686.

If the amd64 architecture won't work, will the archived package also suffer the same trouble?

Edit: Looking on the wiki, it is indeed x86_64, fortunately

I don't know give it a try and report back...

How did you originally get it installed at the top? I am confused? :slight_smile:

root@debian11:~# sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2022-07-11 21:16:36 EDT; 44s ago
       Docs: http://www.elastic.co
...

Elasticsearch requires a 64-bit operating system.

1 Like

It's a 64 bit OS, I think the pentium 5800 works for i386 and i686

1 Like

I originally followed a youtube video here: How To Install And Setup Elasticsearch Engine On Linux - YouTube

They guy in the video did it a very different way from the documentation.

Basically, the only major difference was the use of add-apt-repository which I used to install a package at https://artifacts.elastic.co/packages/6.x/apt as stable main.

From there I installed elasticsearch (sudo apt install elasticsearch), which installed it as a service managed by systemctl on my Debian machine.

To correct my command line input you quoted, it should say sudo systemctl status elasticsearch.service

After I checked the status and waited a few seconds, I received the above error. It's the same output from the log file, which for whatever reason seems to have been deleted by pastebin moderation.

Try the tar.gz and report back

I used the instructions here:

When I got to running ./bin/elasticsearch, I received an error saying that the file ./bin/elasticsearch doesn't exist. Thoughts?

@kamie if you want our help we need details.. otherwise we are just guessing...

What instructions?

Can you show the exact command, path and output I can not help without seeing details.

Is the file there? did you check? Is it executable, with the correct permissions? What directory did you run the command from?

can you run and ls -l on the ./bin directory

Apologies, I'm not sure why it didn't show, here they are again Install Elasticsearch from archive on Linux or MacOS | Elasticsearch Guide [8.3] | Elastic

To summarize, I executed the following commands in the root dir:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.2-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-8.3.2-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-8.3.2-linux-x86_64.tar.gz
cd elasticsearch-8.3.2/

When inspecting the ./bin dir, it doesn't look like there are any directories called "elasticsearch"

I can see there is a directory called ~/elasticsearch-8.3.2 . There is, however, a ./bin/elasticsearch inside of this directory. When I run ./bin/elasticsearch in the directory, I receive the same error messages here:

./bin/elasticsearch-cli: line 14: /root/elasticsearch-8.3.2/jdk/bin/java: cannot execute binary file: Exec format error
./bin/elasticsearch-cli: line 14: /root/elasticsearch-8.3.2/jdk/bin/java: Success

Thanks

Yes, so that means the elasticsearch binary will not run on / is not compatible that OS / HW combination.

Back to what @Christian_Dahlqvist said you are going to need true 64bit OS / Server.

That's weird, because the Pentium specs say that it has a 64 bit instruction set (Intel® Pentium® Processor E5800).

On top of that, the OS I installed was specifically for 64 bit processors (i686 specifically), running dpkg --print-architecture confirms this.

I am not sure what to tell you...
cannot execute binary file: Exec format error
means the binary is not compatible.

BTW it is complaining that the java version that is packaged along with elasticsearch is not compatible.

/root/elasticsearch-8.3.2/jdk/bin/java: cannot execute binary file: Exec format error

I had Java 11 installed to this machine before installing elasticsearch, would this perhaps be the problem? I'd rather avoid uninstalling it unless we're 100% certain that this is the root cause, since there are other java-dependent applications running in the background at the moment.

I am not 100% sure of anything.

Elasticsearch is using the pre-packaged java that comes with elasticsearch... so the error above should not have anything to do with any other java installed.