如何使 apt 忽略已安装软件包的未实现的依赖关系?

如何使 apt 忽略已安装软件包的未实现的依赖关系?

.deb我出于某种原因安装了 Opera 12.16 。假设我需要这个特定版本的特定浏览器,并且没有其他选择。

但是,该 deb 依赖于我的发行版中不再包含的软件包(例如 gstreamer0.10 系列)(Debian 测试)。这使得 apt 失败每一个操作除了apt remove opera依赖性错误:

# apt install cli-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 opera : Depends: gstreamer0.10-plugins-good but it is not installable
         Recommends: flashplugin-nonfree but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

apt --fix-broken install只会建议删除 Opera:

# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  opera
0 upgraded, 0 newly installed, 1 to remove and 92 not upgraded.
1 not fully installed or removed.
After this operation, 46.6 MB disk space will be freed.
Do you want to continue? [Y/n]

目前,我的解决方法是在需要时安装 Opera,并在需要使用 apt 完成其他操作时立即将其删除。这很烦人。

有什么建议么?理想情况下,我想让 apt 永远忽略 opera 的依赖性,因为它足以满足我的目的。

答案1

您无法apt忽略依赖项,但您可以创建一个假gstreamer0.10-plugins-good包来满足缺少的依赖项。最简单的方法是使用equivs

  1. 安装equivs

    sudo apt install equivs
    
  2. 生成模板控制文件

    equivs-control gstreamer0.10-plugins-good.control
    
  3. 修复包名

    sed -i 's/<package name; defaults to equivs-dummy>/gstreamer0.10-plugins-good/g' gstreamer0.10-plugins-good.control
    
  4. 构建包

    equivs-build gstreamer0.10-plugins-good.control
    
  5. 安装它

    sudo dpkg -i gstreamer0.10-plugins-good_1.0_all.deb
    

这应该满足opera包的依赖性。

答案2

您还可以通过编辑 来删除包gstreamer0.10-plugins-good的依赖关系。opera/var/lib/dpkg/status

只需使用文本编辑器打开它,搜索该行Package: opera并在该行下方Depends:删除有问题的gstreamer0.10-plugins-good包。

之后apt再次工作。

相关内容