# Install of apt package is failing

**URL:** <https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385>\
**Category:** Elasticsearch\
**Created:** [September 28, 2018, 8:12pm UTC](https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385 "2018-09-28T20:12:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![meatwad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/meatwad/32/36031_2.png) [@meatwad](https://discuss.elastic.co/u/meatwad)\
**Post date:** [September 28, 2018, 8:12pm UTC](https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385/1 "2018-09-28T20:12:28Z")

</div>

Hi. I'm just getting started with elastic and am having an issue installing the package from the apt repo. Here's the output:

Fri 28 Sep 19:24:00  
root@elastic [~]

# sudo apt-get update && sudo apt-get install elasticsearch

Hit:1 [http://archive.ubuntu.com/ubuntu](http://archive.ubuntu.com/ubuntu) bionic InRelease  
Get:2 [http://archive.ubuntu.com/ubuntu](http://archive.ubuntu.com/ubuntu) bionic-security InRelease [83.2 kB]  
Ign:3 [https://artifacts.elastic.co/packages/6.x/apt](https://artifacts.elastic.co/packages/6.x/apt) stable InRelease  
Get:4 [https://artifacts.elastic.co/packages/6.x/apt](https://artifacts.elastic.co/packages/6.x/apt) stable Release [4,360 B]  
Get:5 [https://artifacts.elastic.co/packages/6.x/apt](https://artifacts.elastic.co/packages/6.x/apt) stable Release.gpg [473 B]  
Get:6 [http://archive.ubuntu.com/ubuntu](http://archive.ubuntu.com/ubuntu) bionic-updates InRelease [88.7 kB]  
Get:7 [https://artifacts.elastic.co/packages/6.x/apt](https://artifacts.elastic.co/packages/6.x/apt) stable/main amd64 Packages [27.0 kB]  
Get:8 [http://archive.ubuntu.com/ubuntu](http://archive.ubuntu.com/ubuntu) bionic-updates/main amd64 Packages [388 kB]  
Fetched 591 kB in 1s (397 kB/s)  
Reading package lists... Done  
Reading package lists... Done  
Building dependency tree  
Reading state information... Done  
The following NEW packages will be installed:  
elasticsearch  
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.  
Need to get 97.9 MB of archives.  
After this operation, 151 MB of additional disk space will be used.  
Get:1 [https://artifacts.elastic.co/packages/6.x/apt](https://artifacts.elastic.co/packages/6.x/apt) stable/main amd64 elasticsearch all 6.4.1 [97.9 MB]  
Fetched 97.9 MB in 5s (20.8 MB/s)  
Selecting previously unselected package elasticsearch.  
(Reading database ... 102199 files and directories currently installed.)  
Preparing to unpack .../elasticsearch\_6.4.1\_all.deb ...  
dpkg: error processing archive /var/cache/apt/archives/elasticsearch\_6.4.1\_all.deb (--unpack):  
new elasticsearch package pre-installation script subprocess returned error exit status 1  
Errors were encountered while processing:  
/var/cache/apt/archives/elasticsearch\_6.4.1\_all.deb  
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is a dedicated ubuntu 18.04.1 KVM VM that I just spun up and has plenty of space storage so that's not the issue:

# df -h /var

Filesystem Size Used Avail Use% Mounted on  
/dev/mapper/ubuntu--vg-ubuntu--lv 115G 2.1G 113G 2% /

Any suggestions would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![meatwad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/meatwad/32/36031_2.png) [@meatwad](https://discuss.elastic.co/u/meatwad)\
**Post date:** [September 28, 2018, 9:19pm UTC](https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385/2 "2018-09-28T21:19:51Z")

</div>

OK, I found what the problem is. I extracted the .deb and in DEBIAN/preinst, if it doesn't find java, it just exits with an error code of 1 (the 'echo' statements are never displayed, the install just fails).

I added 'default-jre' to the Depends line of DEBIAN/control:

Depends: bash, libc6, adduser, coreutils, default-jre

Then rebuilt the .deb. It installs successfully if the default-jre package is already installed and installs it as a dependency if it's not:

# apt-get install ./elasticsearch-6.4.1-mine.deb

Reading package lists... Done  
Building dependency tree  
Reading state information... Done  
Note, selecting 'elasticsearch' instead of './elasticsearch-6.4.1-mine.deb'  
The following additional packages will be installed:  
default-jre  
Suggested packages:  
default-java-plugin  
The following NEW packages will be installed:  
default-jre elasticsearch  
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.  
Need to get 1,092 B/82.4 MB of archives.  
After this operation, 151 MB of additional disk space will be used.  
Do you want to continue? [Y/n]  
Get:1 [http://archive.ubuntu.com/ubuntu](http://archive.ubuntu.com/ubuntu) bionic/main amd64 default-jre amd64 2:1.10-63ubuntu1~02 [1,092 B]  
Get:2 /tmp/elasticsearch-6.4.1-mine.deb elasticsearch all 6.4.1 [82.4 MB]  
Fetched 1,092 B in 1s (867 B/s)  
Selecting previously unselected package default-jre.  
(Reading database ... 116894 files and directories currently installed.)  
Preparing to unpack .../default-jre\_2%3a1.10-63ubuntu1~02\_amd64.deb ...  
Unpacking default-jre (2:1.10-63ubuntu1~02) ...  
Selecting previously unselected package elasticsearch.  
Preparing to unpack /tmp/elasticsearch-6.4.1-mine.deb ...  
Creating elasticsearch group... OK  
Creating elasticsearch user... OK  
Unpacking elasticsearch (6.4.1) ...  
Processing triggers for ureadahead (0.100.0-20) ...  
Setting up default-jre (2:1.10-63ubuntu1~02) ...  
Setting up elasticsearch (6.4.1) ...  
Created elasticsearch keystore in /etc/elasticsearch  
Processing triggers for systemd (237-3ubuntu10.3) ...  
Processing triggers for ureadahead (0.100.0-20) ...

I know you probably don't want to necessarily lock users into using the default-jre package but if they're going through the trouble of installing the elasticsearch package from the repo, that's probably what they'll want to install anyway.

Cheers

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [September 28, 2018, 9:46pm UTC](https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385/3 "2018-09-28T21:46:51Z")

</div>

Thanks for reporting this. We are aware of the issue and plan to do something about it. See the comments in [https://github.com/elastic/elasticsearch/issues/31845](https://github.com/elastic/elasticsearch/issues/31845)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2018, 9:46pm UTC](https://discuss.elastic.co/t/install-of-apt-package-is-failing/150385/4 "2018-10-26T21:46:52Z")

</div>

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