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

查看:25
本文介绍了在 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 <包>
  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天全站免登陆