在Ubuntu中删除损坏的包
当我试图删除一个包时出错,所以它处于断开状态。我尝试了以下方法:在Ubuntu中删除损坏的包,ubuntu,apt,Ubuntu,Apt,当我试图删除一个包时出错,所以它处于断开状态。我尝试了以下方法: sudo dpkg --remove --force-remove-reinstreq rvm 输出: (Reading database ... 41743 files and directories currently installed.) Removing rvm (1.29.3-1) ... bash: rvm: command not found dpkg: error processing package rvm
sudo dpkg --remove --force-remove-reinstreq rvm
输出:
(Reading database ... 41743 files and directories currently installed.)
Removing rvm (1.29.3-1) ...
bash: rvm: command not found
dpkg: error processing package rvm (--purge):
subprocess installed pre-removal script returned error exit status 127
Errors were encountered while processing:
rvm
dpkg: error processing archive rvm (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
rvm
输出:同上
sudo dpkg -i --force-overwrite package
输出:
(Reading database ... 41743 files and directories currently installed.)
Removing rvm (1.29.3-1) ...
bash: rvm: command not found
dpkg: error processing package rvm (--purge):
subprocess installed pre-removal script returned error exit status 127
Errors were encountered while processing:
rvm
dpkg: error processing archive rvm (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
rvm
有没有办法强制删除它,忽略所有错误?我在WSL上使用Ubuntu16.04。我遇到了一个坏包,rvm的问题。我尝试了很多方法,比如
sudo-apt-install-f
和sudo-dpkg--purge--force-all-rvm
,但都没有效果。最后,我终于找到了这篇解释这个问题的博文
以下是步骤
/var/lib/dpkg/info
中查找您的包,例如使用:ls-l/var/lib/dpkg/info | grep
sudo mv /var/lib/dpkg/info/<package>.* /tmp/
以root用户身份执行该命令
sudo apt-get install -f
您需要提升包管理器的权限
sudo apt-get install synaptic
完成了 所以在我的例子中,
perl-modules-5.22
被破坏了。
我遵循了公认答案中的步骤,但这并没有解决我的问题
要修复此问题,我还必须:
sudo apt remove-f perl-modules-5.22
sudo-apt升级-y
sudo apt remove-f
例如:
sudo apt remove mongo*
将删除所有mongo db包。我遇到了一个类似的问题,其中一个包缺少文件,因此无法删除。错误消息为“正在停止服务。无法停止***。服务,服务未运行”
由于缺少服务文件,服务未运行
那么清理包裹不是更容易吗?我想不是
还有:跑步天赋
sudo aptitude
找到有问题的包,检查其信息,验证存在哪些版本。
安装一个与当前版本不同的版本(最好是一个补丁版本,从您必须避免太多更改的版本向上或向下)-它将询问您如何处理丢失的文件-从正在安装的版本中选择替换
sudo apt-get install <package>=<version>
sudo-apt-get-install=
一旦所有这些丢失的文件都被替换,您应该能够执行标准清除
sudo apt-get purge <package>
sudo-apt-get-purge
这对我很有效,WSL上的楔形包也很有效。当问题是关于删除损坏的软件包时,不确定其他“如何安装东西”答案是否相关。步骤2已证明足以解决我的问题。谢谢。这帮我节省了很多时间!。我正在windows 10下使用Ubuntu18.04(作为WSL)并尝试安装docker,您的回答可以帮助我手动安装docker ce软件包。我遇到了一个问题,因为一些非UTF8字符以某种方式插入到/var/lib/dpkg/状态文件中,导致软件包错误。我从文件中删除了那些包(以及非UTF8字符),然后执行步骤2。解决了我的问题!你不需要--force remove reinstreq
之类的东西,一旦那些文件消失了就好了……这并不能回答问题!相反,它提供了另一种安装软件包的方式。
sudo apt-get purge <package>