![Apt 不想安装旧版本的软件包](https://linux22.com/image/982386/Apt%20%E4%B8%8D%E6%83%B3%E5%AE%89%E8%A3%85%E6%97%A7%E7%89%88%E6%9C%AC%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%8C%85.png)
我正在从源代码构建一个 debian 包。该包除其他外,还具有以下依赖项(debian/control 的一部分):
libswarm-dev (>= 0.6.1.0), libswarm-dev (<< 0.7),
这个包和我试图构建的项目与 Yandex.Cocaine 平台和 Reverbrain 公司有关,这些公司并不知名,但我怀疑我的问题更为普遍,与特定的包无关。因此,在连接的 repo 中有很多合适的版本:
vagrant@worker-2:~/cocaine/cocaine-plugins$ apt-cache policy libswarm-dev
libswarm-dev:
Installed: (none)
Candidate: 0.8.1.0
Version table:
0.8.1.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.8.0.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.3.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.2.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.1.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.11 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.10 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.9 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.8 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.7 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.6 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.5 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.4 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.3 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.2 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.7.0.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.5.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.5.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.9 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.8 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.7 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.6 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.5 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.4 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.3 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.2 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
0.6.3.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
vagrant@worker-2:~/cocaine/cocaine-plugins$
但是,出于某种原因,apt-get 不想安装它们。相反,apt 坚持要求安装最新版本:
vagrant@worker-2:~/cocaine/cocaine-plugins$ sudo apt-get install libswarm-dev=0.6.5.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libswarm-dev : Depends: libswarm2 (= 0.6.5.1) but 0.8.1.0 is to be installed
Depends: libswarm2-urlfetcher (= 0.6.5.1) but 0.8.1.0 is to be installed
Depends: libswarm2-xml (= 0.6.5.1) but 0.8.1.0 is to be installed
E: Unable to correct problems, you have held broken packages.
apt-get install -f
也无济于事:
vagrant@worker-2:~/cocaine/cocaine-plugins$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
该包的所有依赖项都libswarm-dev
具有所需的版本:
vagrant@worker-2:~$ apt-cache policy libswarm2
libswarm2:
Installed: (none)
Candidate: 0.8.1.0
Version table:
0.8.1.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
0.6.5.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
vagrant@worker-2:~$ apt-cache policy libswarm2-urlfetcher
libswarm2-urlfetcher:
Installed: (none)
Candidate: 0.8.1.0
Version table:
0.8.1.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
0.6.5.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
vagrant@worker-2:~$ apt-cache policy libswarm2-xml
libswarm2-xml:
Installed: (none)
Candidate: 0.8.1.0
Version table:
0.8.1.0 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
0.6.5.1 0
500 http://repo.reverbrain.com/trusty/ current/amd64/ Packages
...
当然,我可以手动安装它们(我最终也这样做了),但显然这不是正确的方法。我认为这是 apt 的工作,而不是我的。我该如何解决这个问题?
这是 Ubuntu 的 Trusty 版本。
答案1
您是否尝试过以下步骤这里?
如果不快速回顾的话:
- 确保已启用存储
universe
库restricted
。按 Alt+F2,输入 software-properties-gtk 并按 Enter。 - 运行
sudo apt-get update
这将更新您的包索引文件。 - 运行
sudo apt-get clean
。这将清除本地存储库中检索到的包文件(.deb 文件)。 - 运行
sudo apt-get -f install
。这将纠正损坏的依赖关系。 - 跑步
sudo dpkg --configure -a
- 再次运行
sudo apt-get -f install
。