Ubuntu 14.04 Purging ElasticSeach

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'

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:

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:

Any help is greatly appreciated!

Why are you running such an old version of Ubuntu?

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

Try:

sudo apt-get --purge remove elasticsearch

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

dpkg -l | grep elasticsearch

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

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

sudo mkdir -p /var/lib/elasticsearch

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

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.

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