E:子进程/ usr / bin / dpkg返回错误代码(1) - elasticsearch

时间:2018-01-21 10:58:20

标签: ubuntu elasticsearch

我试图卸载elasticsearch并重新安装它。当我用下面的命令删除它时,它显示以下错误。

$ apt-get --purge autoremove elasticsearch

Reading package lists... Done<br/>
Building dependency tree<br/>
Reading state information... Done<br/>
The following packages will be REMOVED:<br/>
elasticsearch*<br/>
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.<br/>
After this operation, 30.5 MB disk space will be freed.<br/>
Do you want to continue? [Y/n] y<br/>
(Reading database ... 37152 files and directories currently installed.)<br/>
Removing elasticsearch (2.4.5) ...<br/>
Stopping elasticsearch service...Failed to issue method call: Unit elasticsearch.service not loaded.<br/>
dpkg: error processing package elasticsearch (--purge):
subprocess installed pre-removal script returned error exit status 5
NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd<br/>

sudo systemctl daemon-reload<br/>
sudo systemctl enable elasticsearch.service<br/>
You can start elasticsearch service by executing<br/>

sudo systemctl start elasticsearch.service<br/>
Errors were encountered while processing:<br/>
** elasticsearch**<br/>
E: Sub-process /usr/bin/dpkg returned an error code (1)<br/>

2 个答案:

答案 0 :(得分:1)

elasticsearch的相同错误已由install jre解决。

答案 1 :(得分:1)

我在Ubuntu 20.04中通过这种方式解决了

  1. java -version
  2. sudo gedit / etc / environment
  3. 在文件中,您必须
    提到下面给出的路径JAVA_HOME =“ / usr / lib / jvm / java- (您的 Java版本,可能是11/14 / etc) -openjdk-amd64“
  4. 回显$ JAVA_HOME