Elasticsearch 7.16 failed install on Unbuntu 20.04 - cannot execute binary file


I'm unable to solve my issue installing Elasticsearch on my new Windows 11 machine running Ubuntu 20.04 (via Windows Subsystem for Linux). The log received is:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 32 not upgraded.
Need to get 344 MB of archives.
After this operation, 552 MB of additional disk space will be used.
Get:1 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 elasticsearch amd64 7.16.2 [344 MB]
Fetched 344 MB in 17min 56s (319 kB/s)
(Reading database ... 61463 files and directories currently installed.)
Preparing to unpack .../elasticsearch_7.16.2_amd64.deb ...
/var/lib/dpkg/tmp.ci/preinst: line 20: .: /etc/default/elasticsearch: cannot execute binary file
dpkg: error processing archive /var/cache/apt/archives/elasticsearch_7.16.2_amd64.deb (--unpack):
 new elasticsearch package pre-installation script subprocess returned error exit status 126
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Having looked into things online, I figured this might be an issue with my Java install or JAVA_HOME environment variable but these seem okay:

echo $JAVA_HOME returns


java --version returns

openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Any insight as to where the issue may be and how to solve it would be greatly appreciated.


Welcome to our community! :smiley:

There's not a lot there to be honest. Is there anything in other system logs that relate to this?

Have a look at this thread which I believe is related.

Thanks for the help.

I read the thread Christian linked and opted for a Windows install. Straight forward, fast, and no issues.

I had Elasticsearch installed and working via Ubuntu/WSL on my previous machine but that was Windows 10 and Intel. I'm now on Windows 11 with AMD and I'm not sure if this could affect things?

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