我在Ubuntu14.04上安装了elasticsearch 6.6.1,但遇到了一些困难。我希望完全卸载elasticsearch并安装一个旧版本。当我跑的时候
sudo apt-get --purge autoremove elasticsearch弹出一条错误消息:
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我不确定elasticseach.service,因为我认为我没有那个文件。我也已经用了
sudo rm -rf /var/lib/elasticsearch/
sudo rm -rf /etc/elasticsearch我试图重新安装elasticsearch,然后使用卸载,但是使用apt-get产生了类似的错误:
Setting up elasticsearch (6.6.1) ...
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.
chown: cannot access ‘/var/lib/elasticsearch’: No such file or directory
dpkg: error processing package elasticsearch (--configure):
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)在我意识到我应该使用apt-get来删除elasticsearch之前,我不确定我是不是搞砸了。任何帮助都是非常感谢的!
发布于 2019-03-01 14:59:19
我跟踪错误信息进入了一个兔子洞,但最终我用
ls -l /var/lib/dpkg/info | grep -I elasticsearch然后删除那些文件。这解决了持续出现的dpkg错误1。在使用sudo apt-get update之后,elasticsearch似乎不再在服务器上了。
这是在这里发布的最后一个解决方案https://itsfoss.com/dpkg-returned-an-error-code-1/,如果您在卸载时遇到类似的错误,您可以先尝试其他解决方案。
https://askubuntu.com/questions/1120463
复制相似问题