在Ubuntu中删除损坏的软件包 [英] Removing broken packages in Ubuntu

查看:555
本文介绍了在Ubuntu中删除损坏的软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试删除软件包时出现错误,因此它处于损坏状态.我尝试了以下方法:

There was an error when I tried to remove a package, so it was left in a broken state. I tried the following:

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

.

sudo dpkg --purge rvm

输出:与上面相同

sudo dpkg -i --force-overwrite package

输出:

dpkg: error processing archive rvm (--install):
 cannot access archive: No such file or directory
Errors were encountered while processing:
 rvm

是否有一种方法可以强制删除它,而忽略所有错误?我在WSL上使用Ubuntu 16.04.

Is there a way to force remove it, ignoring all errors? I'm using Ubuntu 16.04 on WSL.

推荐答案

我遇到了一个损坏的软件包 rvm 的问题.我尝试了许多类似sudo apt install -fsudo dpkg --purge --force-all rvm的方法,但是没有任何效果.最后,我设法找到了说明如何删除损坏的博客的博文. Debian/Ubuntu上的软件包.

I faced this problem with a broken package, rvm. I tried many things like sudo apt install -f and sudo dpkg --purge --force-all rvm but nothing worked. Finally I managed to find this blog post that explains how to remove broken packages on Debian/Ubuntu.

这是步骤.

  1. /var/lib/dpkg/info中找到您的包裹,例如使用:ls -l /var/lib/dpkg/info | grep <package>
  2. 将包文件夹移动到另一个位置,就像我之前提到的博客文章中所建议的那样.

  1. Find your package in /var/lib/dpkg/info, for example using: ls -l /var/lib/dpkg/info | grep <package>
  2. Move the package folder to another location, like suggested in the blog post I mentioned before.

sudo mv /var/lib/dpkg/info/<package>.* /tmp/

  • 运行以下命令:

  • Run the following command:

    sudo dpkg --remove --force-remove-reinstreq <package>
    

  • 例如,我通过在终端中执行以下命令解决了我的问题:

    So as an example I solved my problem by executing the following commands in a terminal:

    sudo mv /var/lib/dpkg/info/rvm.* /tmp/
    sudo dpkg --remove --force-remove-reinstreq rvm
    

    这篇关于在Ubuntu中删除损坏的软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆