1. 程式人生 > >解決UbuntuServer1.14.10安裝build-essential等軟體依賴libc6報錯“The following packages have unmet dependencies” |

解決UbuntuServer1.14.10安裝build-essential等軟體依賴libc6報錯“The following packages have unmet dependencies” |

本文為原創,原文地址: http://blog.csdn.net/duanlove/article/details/54666441

作業系統(Ubuntu server)環境:

# uname -a
Linux ubuntu 3.16.0-23-generic #31-Ubuntu SMP Tue Oct 21 17:56:17 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux


# lsb_release  -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.10
Release:        14.10
Codename:       utopic

網路搜尋關鍵詞:

1、  Ubuntu 報錯 The following packages have unmet dependencies;

2、  Ubuntu server 14.10 即使替換源也無法解決安裝軟體的依賴問題;

3、  Ubuntu server 14.10 原始官方源 apt-get update 報錯, 顯示 如下錯誤“W: Failed to fetch  $URL  Packages  404  Not Found [IP: 137.189.4.14 80]  E: Some index files failed to download. They have been ignored, or old ones used instead.

”;

4、  Ubuntu 部分軟體可以安裝成功,但是某些軟體(如開發類依賴libc6庫的軟體)報依賴錯誤,無法安裝成功;

報錯提示:

The following packages have unmet dependencies:
 libc6-dev : Depends: libc6 (= 2.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

以上報錯的含義是:

    libc6-dev: 依賴: libc6的 “ 2.19-0ubuntu6.9”版本, 但是系統已安裝的是 “2.19-10ubuntu2” 。 

理解了這層意思之後,接下來問題就迎刃而解 了。

報錯命令及全文:

[email protected]:/etc/apt# apt-get 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: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

-------------------------------------

[email protected]:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libc6-dev' instead of 'libc-dev'
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.19-0ubuntu6.9)but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

-------------------------------------

[email protected]:/etc/apt# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libc6-dev' instead of 'libc-dev'
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.19-0ubuntu6.9) but 2.19-10ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.


解決方案:



檢視以安裝的libc
[email protected]:/etc/apt# dpkg -l | grep libc6
ii  libc6:amd64                         2.19-10ubuntu2                     amd64        GNU C Library: Shared libraries


問題在於,當前系統以安裝的 libc6的版本為“2.19-10ubuntu” ,而我們安裝其他軟體(包括build-essential 、g++等)的時候,所依賴的是“2.19-0ubuntu6.9 。

也就是問題在於, 依賴的某個軟體的版本,跟系統以安裝的版本不一致。但 apt-get又不會自動去解除安裝以安裝的自動安裝上依賴的目標版本。 所以導致我們需要手動去解決這個問題。  當前解決這個問題辦法有很多種,我們這裡選擇了,直接強制覆蓋安裝目標版本,替代原來系統已安裝的版本。


# apt-get install  libc6=2.19-0ubuntu6.9
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  glibc-doc
The following packages will be DOWNGRADED:
  libc6
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 77 not upgraded.
Need to get 4,717 kB of archives.
After this operation, 37.9 kB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6 amd64 2.19-0ubuntu6.9 [4,717 kB]
Fetched 4,717 kB in 0s (8,235 kB/s)
Preconfiguring packages ...
dpkg: warning: downgrading libc6:amd64 from 2.19-10ubuntu2 to 2.19-0ubuntu6.9
(Reading database ... 69479 files and directories currently installed.)
Preparing to unpack .../libc6_2.19-0ubuntu6.9_amd64.deb ...
Unpacking libc6:amd64 (2.19-0ubuntu6.9) over (2.19-10ubuntu2) ...
Setting up libc6:amd64 (2.19-0ubuntu6.9) ...
Processing triggers for libc-bin (2.19-10ubuntu2) ...
 

再檢視libc6的已安裝資訊:


[email protected]:/etc/apt# dpkg -l | grep libc6
ii  libc6:amd64                         2.19-0ubuntu6.9                     amd64        Embedded GNU C Library: Shared libraries


再安裝其他原來安裝過程報類似錯誤的軟體:

# apt-get install zlib1g-dev libc6-dev libc-dev libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libc6-dev' instead of 'libc-dev'
The following extra packages will be installed:
  libc-dev-bin libmysqlclient18 linux-libc-dev manpages-dev mysql-common
Suggested packages:
  glibc-doc
The following NEW packages will be installed:
  libc-dev-bin libc6-dev libmysqlclient-dev linux-libc-dev manpages-dev zlib1g-dev
The following packages will be upgraded:
  libmysqlclient18 mysql-common
2 upgraded, 6 newly installed, 0 to remove and 75 not upgraded.
Need to get 6,234 kB of archives.
After this operation, 24.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main mysql-common all 5.5.54-0ubuntu0.14.04.1 [13.0 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient18 amd64 5.5.54-0ubuntu0.14.04.1 [597 kB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc-dev-bin amd64 2.19-0ubuntu6.9 [69.0 kB]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-proposed/main linux-libc-dev amd64 3.13.0-108.155 [772 kB]
Get:5 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libc6-dev amd64 2.19-0ubuntu6.9 [1,910 kB]
Get:6 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main zlib1g-dev amd64 1:1.2.8.dfsg-1ubuntu1 [183 kB]
Get:7 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libmysqlclient-dev amd64 5.5.54-0ubuntu0.14.04.1 [869 kB]
Get:8 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main manpages-dev all 3.54-1ubuntu1 [1,820 kB]
Fetched 6,234 kB in 1s (5,609 kB/s)
(Reading database ... 69479 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.5.54-0ubuntu0.14.04.1_all.deb ...
Unpacking mysql-common (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) ...
Preparing to unpack .../libmysqlclient18_5.5.54-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient18:amd64 (5.5.54-0ubuntu0.14.04.1) over (5.5.40-0ubuntu1) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../libc-dev-bin_2.19-0ubuntu6.9_amd64.deb ...
Unpacking libc-dev-bin (2.19-0ubuntu6.9) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../linux-libc-dev_3.13.0-108.155_amd64.deb ...
Unpacking linux-libc-dev:amd64 (3.13.0-108.155) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../libc6-dev_2.19-0ubuntu6.9_amd64.deb ...
Unpacking libc6-dev:amd64 (2.19-0ubuntu6.9) ...
Selecting previously unselected package zlib1g-dev:amd64.
Preparing to unpack .../zlib1g-dev_1%3a1.2.8.dfsg-1ubuntu1_amd64.deb ...
Unpacking zlib1g-dev:amd64 (1:1.2.8.dfsg-1ubuntu1) ...
Selecting previously unselected package libmysqlclient-dev.
Preparing to unpack .../libmysqlclient-dev_5.5.54-0ubuntu0.14.04.1_amd64.deb ...
Unpacking libmysqlclient-dev (5.5.54-0ubuntu0.14.04.1) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../manpages-dev_3.54-1ubuntu1_all.deb ...
Unpacking manpages-dev (3.54-1ubuntu1) ...
Processing triggers for man-db (2.7.0.2-2) ...


從以上安裝過程看出來,成功安裝了。  

我們再次執行如下命令 通過dpkg來查詢具體安裝資訊:


[email protected]:/etc/apt# dpkg -l | grep -E "zlib1g-dev|libc6-dev|libc-dev|libmysqlclient-dev"
ii  libc-dev-bin                        2.19-0ubuntu6.9                     amd64        Embedded GNU C Library: Development binaries
ii  libc6-dev:amd64                     2.19-0ubuntu6.9                     amd64        Embedded GNU C Library: Development Libraries and Header Files
ii  libmysqlclient-dev                  5.5.54-0ubuntu0.14.04.1             amd64        MySQL database development files
ii  linux-libc-dev:amd64                3.13.0-108.155                      amd64        Linux Kernel Headers for development
ii  zlib1g-dev:amd64                    1:1.2.8.dfsg-1ubuntu1               amd64        compression library - development

再次確認build-essential  是否可以成功安裝:

# dpkg -l | grep build-essential

當前系統沒有安裝 build-essential

# dpkg -l | grep g++
當前系統沒有安裝 g++

# dpkg -l | grep gcc
ii  gcc                                 4:4.8.2-1ubuntu6                    amd64        GNU C compiler
ii  gcc-4.8                             4.8.4-2ubuntu1~14.04.3              amd64        GNU C compiler
ii  gcc-4.8-base:amd64                  4.8.4-2ubuntu1~14.04.3              amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9-base:amd64                  4.9.1-16ubuntu6                     amd64        GCC, the GNU Compiler Collection (base package)
ii  libgcc-4.8-dev:amd64                4.8.4-2ubuntu1~14.04.3              amd64        GCC support library (development files)
ii  libgcc1:amd64                       1:4.9.1-16ubuntu6                   amd64        GCC support library

安裝 build-essential (g++也會被附帶安裝,所以只要安裝這個基礎套件,基本的編譯環境就ok了): 
# apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  g++ g++-4.8 libstdc++-4.8-dev
Suggested packages:
  g++-multilib g++-4.8-multilib gcc-4.8-doc libstdc++6-4.8-dbg libstdc++-4.8-doc
The following NEW packages will be installed:
  build-essential g++ g++-4.8 libstdc++-4.8-dev
0 upgraded, 4 newly installed, 0 to remove and 75 not upgraded.
Need to get 19.2 MB of archives.
After this operation, 40.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main libstdc++-4.8-dev amd64 4.8.4-2ubuntu1~14.04.3 [1,053 kB]
Get:2 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-security/main g++-4.8 amd64 4.8.4-2ubuntu1~14.04.3 [18.1 MB]
Get:3 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main g++ amd64 4:4.8.2-1ubuntu6 [1,490 B]
Get:4 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty/main build-essential amd64 11.6ubuntu6 [4,838 B]
Fetched 19.2 MB in 1s (9,947 kB/s)
Selecting previously unselected package libstdc++-4.8-dev:amd64.
(Reading database ... 72784 files and directories currently installed.)
Preparing to unpack .../libstdc++-4.8-dev_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking libstdc++-4.8-dev:amd64 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package g++-4.8.
Preparing to unpack .../g++-4.8_4.8.4-2ubuntu1~14.04.3_amd64.deb ...
Unpacking g++-4.8 (4.8.4-2ubuntu1~14.04.3) ...
Selecting previously unselected package g++.
Preparing to unpack .../g++_4%3a4.8.2-1ubuntu6_amd64.deb ...
Unpacking g++ (4:4.8.2-1ubuntu6) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../build-essential_11.6ubuntu6_amd64.deb ...
Unpacking build-essential (11.6ubuntu6) ...
Processing triggers for man-db (2.7.0.2-2) ...
#

安裝過程成功走完,並且無任何報錯提示。

檢查 build-essential   和 g++是否成功安裝:

# dpkg -l | grep -E "build-essential|g\+\+"
ii  build-essential                     11.6ubuntu6                         amd64        Informational list of build-essential packages
ii  g++                                 4:4.8.2-1ubuntu6                    amd64        GNU C++ compiler
ii  g++-4.8                             4.8.4-2ubuntu1~14.04.3              amd64        GNU C++ compiler 

確定已成功安裝!!!!

最終問題解決。

補充:

     這裡有個深層次的原因: Ubuntu 14.10 版本在當前(2016/2017)已經從維護名單裡面去除了,相應的源也不再支援,所以導致原始匹配版本的源無法使用,ping不通伺服器ip。 而我這裡配置的是 14.04對應的源, 其安裝軟體時依賴的版本是與 14.10是有差異的,所以導致 安裝一些軟體的時候, 依賴的軟體的版本總是比當前系統已經安裝的版本要低。 導致依賴衝突,最終導致安裝軟體無法順利進行。 

相關推薦

解決UbuntuServer1.14.10安裝build-essential軟體依賴libc6The following packages have unmet dependencies” |

本文為原創,原文地址: http://blog.csdn.net/duanlove/article/details/54666441 作業系統(Ubuntu server)環境: # uname -a Linux ubuntu 3.16.0-23-generic #3

docker build The following signatures were invalid

構建映象的時候遇到 GPG error: https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64 Release: The following signatures we

解決ubuntu 13.10的雙拼中文輸入法的問題(安裝fcitx)

ubuntu 13.10的輸入法變化較大,以前所有版本的設定雙拼的方法已經用不了了... 可能是bug吧.... 哥只好在虛擬機器測試了下ubuntu的中文版ubuntuKylin, 看看ubuntuKylin上的中文輸入法是怎麼安裝的,ubuntuKylin的中文輸入法非

Ubuntu 14 10安裝SecureCRT 7 3

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

Ubuntu 14.10安裝配置Qt 5.5.1

1、在命令列cd進入qt-opensource-linux-x86-5.5.1.run安裝包所在目錄,並輸入安裝命令:sudo ./qt-opensource-linux-x86-5.5.1.run: 2、進入如下介面,點選“Next>”: 3、點選“S

Ubuntu 14.10 安裝freemind

freemind是免費的思維導圖軟體,在ubuntu上安裝僅需要執行命令:apt-get install freemind但是執行的時候報錯:~$ freemind [warning] /usr/bi

ubuntu 14.10 安裝uboot-mkimage

在網上查了下,使用apt-get install uboot-mkimage時,彈出錯誤如下: [email protected]:/etc/apt$ sudo apt-get install uboot-mkimage Reading package lists

Ubuntu 14.10 安裝samba伺服器

1.安裝samba$sudo apt-get install samba 2.編輯配置表 $vi /etc/samba/smb.conf 在最後增加以下SECTION: [ home ] comment = workplace browseable = yes writea

解決Ubuntu 13.10安裝Nvidia驅動出錯問題

2014.1.10更新: 11月6日更新的NVIDIA顯示驅動331.20終於支援3.12核心了,下載最新版本驅動即可。 宣告,只針對NVIDIA-Linux-x86_64-319.60.run版本,

Spring,SpringMVC,Mybatis配置文件解決(Referenced file contains errors)

info ems art valid mes ont conf window 程序   今天自己搭建了ssm框架,頭文件什麽的都是拷貝的筆記的,本來不會出錯。可是偏偏報錯(如下): Referenced file contains errors (http://www.i

【前端技術】nodejs安裝擴展插件,總是enoent的解決方案

擴展 執行 src 自動填充 install image 都是 切換 -s 在某一目錄下使用npm install安裝擴展插件時,老是系統提示“npm install Error: ENOENT,no such file or directory; 以前都是很順利的安裝過

python2,python3同時安裝時,python3可以安裝並升級pip庫,python2解決辦法

用戶目錄 python3 error: nbsp python http customize nta tro 最近在使用pip安裝包的的時候出現下面錯誤 UnicodeEncodeError: ‘ascii‘ codec can‘t encode characte

Linux安裝VMware 出現“VMware kernel module updater”解決辦法

//系統 # cat /etc/redhat-release CentOS release 6.10 (Final) # uname -r 2.6.32-754.3.5.el6.x86_64 //解決方法,安裝核心開發包 # yum -y install kernel-devel

解決CentOS下安裝jdk無法解壓問題(gzip: stdin: not in gzip format tar: Child returned status 1...... )

  CentOS下自帶openjdk,但是有些成(如ES)要在jdk1.8及以上環境才能安裝,因此要解除安裝系統自帶的openjdk再到官網下載Linux下的jdk,但是在下載後解壓時,會發現報錯:   原因分析: wget命令直接下載的JDK,這是問題的

如何解決JSP頁面頂端 The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

題目有點長,昨天剛接觸jsp,按照網上的教程安裝完 tomcat 和 eclipse EE 之後,新建jsp檔案卻出現瞭如下報錯: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 教程

2018最新win10 安裝tensorflow1.4(GPU/CPU)+cuda8.0+cudnn8.0-v6 + keras 安裝CUDA莫名失敗 匯入tensorflow失敗問題解決

基本開發環境搭建 1. Microsoft Windows 版本 關於Windows的版本選擇,本人強烈建議對於部分高效能的新機器採用Windows 10作為基礎環境,部分老舊筆記本或低效能機器採用Windows 7即可,本文環境將以Windows 10作為開發環境進行描述。對於Windows 10

安裝docker成功後,啟動docker解決方法

[[email protected] ~]# systemctl restart docker Job for docker.service failed because the control process exited with error code. Se

[Cassandra] Cassandra3.10建立表時“Column family ID mismatch”解決

  記一次cassandra建立表時“Column family ID mismatch”報錯解決 環境:CentOS6.7 + JDK8 + Cassandra3.10   問題: Cassandra建立表時報錯: [email prote

'com.android.tools.build:gradle:2.3.0' 版本解決Plugin used. Try disabling Instant Run (or updating. ..

今天下載路由框架原始碼進行閱讀的時候,gradle 報錯了,“Plugin used. Try disabling Instant Run (or updating either the IDE or the Gradle plugin to the latest vers

使用gem安裝軟體(cocoapods fastlane),You don't have write permissions for the /usr/bin directory.

我們是用gem 安裝一些外掛時,有時會遇到報錯You don't have write permissions for the /usr/bin directory.即使我們在安裝命令前加上sudo,也不行。這時我們可以使用: sudo gem install fastla