build-essential
在新安装的 Ubuntu 18.10 上安装失败,并出现以下错误:
$ sudo apt install build-essential
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:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: gcc (>= 4:7.3) but it is not going to be installed
Depends: g++ (>= 4:7.3) but it is not going to be installed
Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
通过安装deb 文件也失败了。
我认为此包未正确移植到 18.10,因为它要求使用过时的依赖项(依赖项版本在 18.04 LTS 中可用)。安装它的最安全方法是什么?
请注意,我已经使用不安全的方法安装了它(在其他机器上),例如通过 aptitude 降级软件包,但这种方法破坏了太多其他软件包。
更新#1:
libc6-dev安装失败。
$ sudo apt install libc6-dev
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:
libc6-dev : Depends: libc6 (= 2.27-3ubuntu1) but 2.28-0ubuntu1 is to be installed
Depends: libc-dev-bin (= 2.27-3ubuntu1)
E: Unable to correct problems, you have held broken packages.
我不知道为什么 apt 正在寻找旧版本的libc6
和libc-dev-bin
。
类似地,apt 表明海湾合作委员会还依赖于 的先前版本cpp
。
$ sudo apt install gcc
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:
gcc : Depends: cpp (= 4:8.1.0-2ubuntu1) but 4:8.2.0-1ubuntu1 is to be installed
Depends: gcc-8 (>= 8.1.0-4~) but it is not going to be installed
Recommends: libc6-dev but it is not going to be installed or
libc-dev
E: Unable to correct problems, you have held broken packages.
更新 #2:apt-cache 策略输出
$ apt-cache policy gcc cpp
gcc:
Installed: (none)
Candidate: 4:8.1.0-2ubuntu1
Version table:
4:8.1.0-2ubuntu1 500
500 http://pk.archive.ubuntu.com/ubuntu cosmic/main amd64 Packages
cpp:
Installed: 4:8.2.0-1ubuntu1
Candidate: 4:8.2.0-1ubuntu1
Version table:
*** 4:8.2.0-1ubuntu1 100
100 /var/lib/dpkg/status
4:8.1.0-2ubuntu1 500
500 http://pk.archive.ubuntu.com/ubuntu cosmic/main amd64 Packages
答案1
我怀疑(现已证明)你使用的镜像已经过时了,例如如果你检查https://launchpad.net/ubuntu/+archivemirrors我相信你选择的镜子会列出最后更新未知(由于时间太久,计数器溢出)因此您的包裹出现问题。
我怀疑这是因为你的结果与预期的包裹不匹配https://packages.ubuntu.com/
解决方法是切换到维护的镜像(来自上述列表)或主档案。
答案2
我使用的是过时的pk.archive.ubuntu.com
档案镜像由 Nayatel 提供
$ ping pk.archive.ubuntu.com
PING mirrors.nayatel.com (115.186.188.244) 56(84) bytes of data.
64 bytes from mirrors.nayatel.com (115.186.188.244): icmp_seq=1 ttl=56 time=65.9 ms
切换到官方版本后问题已解决Main server
。感谢 @guiverc 指出此问题。
更新:
我通过电子邮件向他们反映这个问题[email protected]
,但他们禁用了它,因为它不符合要求 国家镜像要求