Debian

如何使 apt 忽略已安裝包的未實現依賴項?

  • February 29, 2020

.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).

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]

目前,我的解決方法是在需要時安裝 Opera,並在需要使用 apt 完成其他任何操作時將其刪除。這很煩人。

有什麼建議麼?理想情況下,我想讓 apt 永遠忽略歌劇的依賴關係,因為它對我的目的來說已經足夠好了。

您不能apt忽略依賴項,但您可以創建一個假gstreamer0.10-plugins-good包來滿足缺少的依賴項。最簡單的方法是使用equivs

  1. 安裝equivs
sudo apt install equivs
  1. 生成模板控製文件
equivs-control gstreamer0.10-plugins-good.control
  1. 修復包名
sed -i 's/<package name; defaults to equivs-dummy>/gstreamer0.10-plugins-good/g' gstreamer0.10-plugins-good.control
  1. 建構包
equivs-build gstreamer0.10-plugins-good.control
  1. 安裝它
sudo dpkg -i gstreamer0.10-plugins-good_1.0_all.deb

那應該滿足opera包的依賴。

引用自:https://unix.stackexchange.com/questions/404444