如何使 apt 忽略已安装包的未满足的依赖项?

Jon*_*fer 10 debian apt dependencies package-management

.deb出于某些原因,我从 a 安装了 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).
Run Code Online (Sandbox Code Playgroud)

apt --fix-broken install 只会提议删除歌剧:

# 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]
Run Code Online (Sandbox Code Playgroud)

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

有什么建议?理想情况下,我想让 apt 永远忽略歌剧的依赖关系,因为它对我的目的来说已经足够好了。

Ste*_*itt 16

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

  1. 安装 equivs

    sudo apt install equivs
    
    Run Code Online (Sandbox Code Playgroud)
  2. 生成模板控制文件

    equivs-control gstreamer0.10-plugins-good.control
    
    Run Code Online (Sandbox Code Playgroud)
  3. 修复包名

    sed -i 's/<package name; defaults to equivs-dummy>/gstreamer0.10-plugins-good/g' gstreamer0.10-plugins-good.control
    
    Run Code Online (Sandbox Code Playgroud)
  4. 构建包

    equivs-build gstreamer0.10-plugins-good.control
    
    Run Code Online (Sandbox Code Playgroud)
  5. 安装它

    sudo dpkg -i gstreamer0.10-plugins-good_1.0_all.deb
    
    Run Code Online (Sandbox Code Playgroud)

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


小智 8

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

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

之后apt再次工作。