如何卸载未完全安装或删除的软件包?

如何卸载未完全安装或删除的软件包?

好吧,这就是我的问题,我尝试安装 Spotify。但安装得并不顺利,所以我决定卸载它。作为一个彻头彻尾的新手,我以为删除安装它的文件夹可以解决我的问题。我在 Google 上搜索了如何正确删除包,但现在根本不起作用。

(Reading database ... 95881 files and directories currently installed.)
Removing spotify-client ...
/var/lib/dpkg/info/spotify-client.prerm: 9: cd: can't cd to /opt/spotify/spotify-client
dpkg: error processing spotify-client (--remove):
subprocess installed pre-removal script returned error exit status 2
/var/lib/dpkg/info/spotify-client.postinst: 5: cd: can't cd to /opt/spotify/spotify-client
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
spotify-client
E: Sub-process /usr/bin/dpkg returned an error code (1)

我比以前更加迷茫了,请帮助我。

内容/var/lib/dpkg/info/spotify-client.prerm

#!/bin/sh
#
# Copyright (c) 2012 Spotify AB

# We could be smart and not clean up on upgrade,
# but I worry that we'll leave old crap around
# when we change things.

cd /opt/spotify/spotify-client && ./unregister.sh

答案1

删除失败,因为由于命令失败cd(该目录不再存在),无法成功执行预删除脚本;通过在开头/var/lib/dpkg/info/spotify-client.prerm添加一个来注释掉这一行:#

cd /opt/spotify/spotify-client && ./unregister.sh

这样它就变成了这样:

# cd /opt/spotify/spotify-client && ./unregister.sh

答案2

您可以随时重新安装 Spotify,然后使用适当的方法将其删除。这样,您将再次在系统上拥有所有需要的文件。

相关内容