When I run ./bin/elasticsearch command, I get the following error:

./bin/elasticsearch-cli: line 14: /home/samira/elasticsearch-8.4.2/jdk/bin/java: cannot execute binary file: Exec format error
./bin/elasticsearch-cli: line 14: /home/samira/elasticsearch-8.4.2/jdk/bin/java: Success

This is my elasticsearch-cli:


set -e -o pipefail

source "`dirname "$0"`"/elasticsearch-env

# use a small heap size for the CLI tools, and thus the serial collector to
# avoid stealing many CPU cycles; a user can override by setting CLI_JAVA_OPTS
CLI_JAVA_OPTS="-Xms4m -Xmx64m -XX:+UseSerialGC ${CLI_JAVA_OPTS}"


exec \
  "$JAVA" \
  -Dcli.name="$CLI_NAME" \
  -Dcli.script="$0" \
  -Dcli.libs="$CLI_LIBS" \
  -Des.path.home="$ES_HOME" \
  -Des.path.conf="$ES_PATH_CONF" \
  -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
  org.elasticsearch.launcher.CliToolLauncher \

I run java -version and it outputs:

openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode)

Then I run lscpu and it outputs:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           94
Model name:                      Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Stepping:                        3
CPU MHz:                         1098.724
CPU max MHz:                     3600.0000
CPU min MHz:                     800.0000
BogoMIPS:                        6399.96
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        6 MiB
NUMA node0 CPU(s):               0-3
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Mitigation; Clear CPU buffers; SMT disabled
Vulnerability Retbleed:          Mitigation; IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; IBRS, IBPB conditional, RSB filling
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Mitigation; TSX disabled
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss 
                                 ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_
                                 tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1
                                  sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault
                                  invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx s
                                 map clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window h
                                 wp_epp md_clear flush_l1d arch_capabilities

How can I fix this error?

  • Please do not show pictures of text. Cut and paste the text into the body of the question. It makes it easier to read and allows for searching the text.
    – David
    Oct 1 at 8:28
  • this seems to be a wrong JDK installed on your system, could you please run lscpu and java -version and add the output to your question?
    – Amirreza
    Oct 1 at 8:30
  • I edited my question and added error @David Oct 1 at 8:30
  • how can I run lscpu and java -version@Amirreza Oct 1 at 8:37
  • 2
    and that's exactly the issue :) your CPU architecture is x86_64 not aarch64, I'll fill and answer
    – Amirreza
    Oct 1 at 9:04

1 Answer 1


Your CPU architecture is x86_64 while the downloaded elastic-search is aarch64

go to the elasticsearch directory, open a terminal there and run ./uninstall.sh to uninstall the current aarch64 version, then install the correct release;

there are two releases for that architecture you can download, one is a .tar.gz file and the other a .deb file, .deb installation files are easier to install and also easier to uninstall, so the correct version to install is either the elasticsearch-8.4.2-amd64.deb (recommended) or elasticsearch-8.4.2-linux-x86_64.tar.gz

I suggest the first one

  • this link can be helpful to uninstall: netbraintech.com/docs/ie80/help/uninstalling-elasticsearch.htm
    – Amirreza
    Oct 1 at 9:15
  • I test your answer but I get this error!!!ERROR: Elasticsearch exited unexpectedly Oct 1 at 10:03
  • does it happen when uninstalling it? in which phase?
    – Amirreza
    Oct 1 at 11:24
  • my bad @samirapadidar, elastic search isn't actually installed in your system as you could not run the installer (because it's a different unsupported architecture), so ignore the "uninstalling" part and just install the .deb file
    – Amirreza
    Oct 1 at 14:00
  • Hi Amirreza thanks for your answers I successed to install elasticserch and kibana and actived them but now I dont know what is my passwort for user 'elastic'!!! I be a liitle confused becaus Im so beginer in elasticsearch Oct 2 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.