在 Ubuntu 18.10中,apt构建基本而不是因为未完成的依赖而安装

分享于 

6分钟阅读

ubuntu

 

问题:

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版本中可用的依赖版本)。 安装它最安全的方法是什么?

注意,我已经安装了( 在其他机器上),但是 比如 通过with将包降级,但这种方法将过多的它的他包。

更新 #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为什么要查找旧版本的libc6libc-dev-bin

同样,apt显示 gcc 也依赖于以前版本的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 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,我相信你选择的镜像会列出你最近一次更新的unknown (。计数器溢出过长),所以你的软件包的woes。

我怀疑这是因为你的结果没有在 https://packages.ubuntu.com/服务器上使用预期的软件包。

修复是 switch 到一个维护的镜像( 从上述列表中) 或者主存档。


回答 2:

我使用了过期的pk.archive.ubuntu.com归档镜像镜像,由提供


$ 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



enter image description here

切换到正式 Main server 后问题已经解决。 感谢 @guiverc 表示这里问题。

这是我向 mirrors@ubuntu.com 发送的邮件,他们禁用了它,因为它没有遵循国家镜像要求。



构建  DEP  Ubuntu  依赖  installing  ESS