# Ubuntu 14.04 Purging ElasticSeach

**URL:** <https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695>\
**Category:** Elasticsearch\
**Created:** [February 24, 2019, 2:56am UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695 "2019-02-24T02:56:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![txu](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@txu](https://discuss.elastic.co/u/txu)\
**Post date:** [February 24, 2019, 2:56am UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/1 "2019-02-24T02:56:43Z")

</div>

Hello, I am a coop student trying to use elastic search for the first time. However, I ran into a few problem while trying to initially use elastic search after installation and also during the uninstall process. I am using a Ubuntu 14.04 with 6.6.1 elastic search.

When I initially installed and started the elastic search service, I can see the default ports 9200 and 9300 listening but when I used

curl -X GET '[http://localhost:9200](http://localhost:9200)'

the return is simply empty, like when you run a long script with no progress outputs, and I have to ctrl-z out of it. No errors or any outputs. However, currently I wish to reinstall an older version of elasticsearch but during uninstall using

sudo apt-get --purge autoremove elasticsearch

I get an error message:

```auto
Removing elasticsearch (6.6.1) ...
Stopping elasticsearch service...Failed to issue method call: Unit elasticsearch.service not loaded.
dpkg: error processing package elasticsearch (--remove):
 subprocess installed pre-removal script returned error exit status 5
Failed to issue method call: Unit systemd-sysctl.service failed to load: No such file or directory. See system logs and 'systemctl status systemd-sysctl.service' for details.
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service
chown: cannot access ‘/var/lib/elasticsearch’: No such file or directory
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 elasticsearch

```

I did post this question on askubuntu but no luck yet:

> <https://askubuntu.com/questions/1120463/ubuntu-14-04-purging-elasticseach>

Any help is greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 24, 2019, 7:31am UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/2 "2019-02-24T07:31:25Z")

</div>

Why are you running such an old version of Ubuntu?

---

<div class="post-metadata">

**Author:** ![txu](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@txu](https://discuss.elastic.co/u/txu)\
**Post date:** [February 24, 2019, 2:19pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/3 "2019-02-24T14:19:38Z")

</div>

Unfortunately it is not up to me, the server I SSH to simply has that version

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [February 24, 2019, 7:11pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/4 "2019-02-24T19:11:25Z")

</div>

Try:

> sudo apt-get --purge remove elasticsearch

if that fails you can check if elasticsearch is still installed with

> dpkg -l | grep elasticsearch

---

<div class="post-metadata">

**Author:** ![txu](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@txu](https://discuss.elastic.co/u/txu)\
**Post date:** [February 27, 2019, 2:47pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/5 "2019-02-27T14:47:50Z")

</div>

Thanks for the suggestion but this is still the result:

```
xuyou@MBMORDA646277D:/usr/lib/systemd$ sudo apt-get --purge remove elasticsearch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  elasticsearch*
0 upgraded, 0 newly installed, 1 to remove and 346 not upgraded.
1 not fully installed or removed.
After this operation, 168 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 236574 files and directories currently installed.)
Removing elasticsearch (6.6.1) ...
Stopping elasticsearch service...Failed to issue method call: Unit elasticsearch.service not loaded.
dpkg: error processing package elasticsearch (--purge):
 subprocess installed pre-removal script returned error exit status 5
Failed to issue method call: Unit systemd-sysctl.service failed to load: No such file or directory. See system logs and 'systemctl status systemd-sysctl.service' for details.
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
 sudo systemctl daemon-reload
 sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
 sudo systemctl start elasticsearch.service
chown: cannot access ‘/var/lib/elasticsearch’: No such file or directory
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 elasticsearch
E: Sub-process /usr/bin/dpkg returned an error code (1)

```

and when I check is elasticsearch is still there:

```
xuyou@MBMORDA646277D:/usr/lib/systemd$ dpkg -l | grep elasticsearch
pF elasticsearch 6.6.1 all Elasticsearch is a distributed RESTful search engine built for the cloud. Reference documentation can be found at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html and the 'Elasticsearch: The Definitive Guide' book can be found at https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html
```

---

<div class="post-metadata">

**Author:** ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)\
**Post date:** [February 27, 2019, 4:21pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/6 "2019-02-27T16:21:21Z")

</div>

You need to get creative here.. it fails because it cannot find a directory.  
Create it

```auto
sudo mkdir -p /var/lib/elasticsearch

```

and try again.. Look at the error, read it and work with it. This is my mantra...

---

<div class="post-metadata">

**Author:** ![txu](https://avatars.discourse-cdn.com/v4/letter/t/5f9b8f/32.png) [@txu](https://discuss.elastic.co/u/txu)\
**Post date:** [March 1, 2019, 2:52pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/7 "2019-03-01T14:52:18Z")

</div>

Thanks for your suggestion, I went down the rabbit hole of following the error messages and doing what it says but eventually I just used

`ls -l /var/lib/dpkg/info | grep -i elasticsearch`

and then removing those files and it seemed to work as dpkg no longer returns error code 1 and elasticsearch no longer seems to be on the server.

---

<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:** [March 29, 2019, 2:52pm UTC](https://discuss.elastic.co/t/ubuntu-14-04-purging-elasticseach/169695/8 "2019-03-29T14:52:19Z")

</div>

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