Ubuntu的12.04 libudev-dev将不会安装,因为依赖关系

我有一个示例c ++代码,使用udev库接收热插拔事件。 它在Ubuntu 10.04中运行良好。 这只是libudev-dev软件包的先决条件:sudo apt-get install libudev-dev

但是当我在12.04试图安装这个软件包时,我得到:

sudo apt-get install libudev-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: libudev-dev : Depends: libudev0 (= 175-0ubuntu9) but 175-0ubuntu9.3 is to be installed E: Unable to correct problems, you have held broken packages. 

这似乎意味着我应该安装libudev0,所以:

 sudo apt-get install libudev0 Reading package lists... Done Building dependency tree Reading state information... Done libudev0 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

我不知道如何从这里开始。 libudev-dev依赖于libudev0,但已经到位了,所以…下一步是什么?

请注意,下面的回购在source.list中没有评论,我做了一个apt-get更新:

 deb http://us.archive.ubuntu.com/ubuntu/ precise main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ precise main restricted deb http://us.archive.ubuntu.com/ubuntu/ precise universe deb-src http://us.archive.ubuntu.com/ubuntu/ precise universe 

有些网站表示我应该这样做-f:

 sudo apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

find一个很好的链接在这里: https : //askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies但没有喜悦。

谷歌说这是对其他人的扣篮…

谢谢你的帮助,约翰

这是解决方案。

当你阅读以下内容时:

 The following packages have unmet dependencies: libudev-dev : Depends: libudev0 (= 175-0ubuntu9) but 175-0ubuntu9.3 is to be installed E: Unable to correct problems, you have held broken packages. 

这意味着我想安装的libudev-dev包取决于包:

 libudev0 version 175-0ubuntu9 

(这就是“ (= 175-0ubuntu9) ”想说的)

但libudev0版本175-0ubuntu9.3已经安装。

(这就是“ 但要安装175-0ubuntu9.3 ”正在试图说)。

换句话说:

  • 已经安装了更新版本的libudev0。
  • 我想安装的libudev-dev软件包取决于旧版本的libudev0,它已经安装。
  • 这又意味着我正在安装libudev-dev的存储库已过期。

您可以通过以下方式找到您目前在/etc/apt/sources.list中列出的所有存储库中可用的软件包:

 sudo apt-cache madison libudev-dev sudo apt-cache madison libudev0 

所以最后我们到了真正的问题! 我在sources.list中的存储库列表中缺少一个包含libudev-dev 175-0ubuntu9.3的存储库。

要解决这个问题:

  1. http://packages.ubuntu.com搜索“libudev-dev”

  2. 在结果列表中找到Precise穿山甲(Ubuntu 12.04)的175-0ubuntu9.3。 在这种情况下,该版本是在“精确udpates”。 你可以点击链接:

    http://packages.ubuntu.com/precise-updates/libudev-dev

    它显示了你想了解libudev-dev的所有信息。 除了它不显示确切的回购网址我应该使用! 所以我要稍微猜测一下

  3. 添加回购apt

     sudo gedit /etc/apt/sources.list [ add these two repos ] deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates main 
  4. 刷新

     sudo apt-get update sudo apt-cache madison libudev-dev [you should see libudev-dev 175-0ubuntu9.3 in the output] libudev-dev | 175-0ubuntu9.3 | http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages 
  5. 安装软件包:

     sudo apt-get install libudev-dev 

    这就像一个魅力!

约翰

不。 不能像魅力一样工作。

@ubuntu:〜$ sudo apt-cache madison libudev-dev

libudev-dev | 175-0ubuntu9.8 | http://archive.ubuntu.com/ubuntu/ precise-updates / main amd64包

libudev-dev | 175-0ubuntu9.8 | http://us.archive.ubuntu.com/ubuntu/ precise-updates / main amd64包

ubuntu:〜$ sudo apt-get install libudev-dev

Paketlisten werden gelesen … Fertig

Abhängigkeitsbaumwird aufgebaut

Statusinformationen werden eingelesen … Fertig

libudev-dev ist schon die neueste Version。

Probieren Sie»apt-get -f install«,我死了zu korrigieren:

Die folgenden Pakete habenunerfüllteAbhängigkeiten:

libudev-dev:Hängtab von:libudev0(= 175-0ubuntu9.8)aber 175-0ubuntu9 soll installiert werden

libudev0:Beschädigt:libudev0:i386(!= 175-0ubuntu9)aber 175-0ubuntu9.8 soll installiert werden

libudev0:i386:Beschädigt:libudev0(!= 175-0ubuntu9.8)aber 175-0ubuntu9 soll installiert werden

E:UnerfüllteAbhängigkeiten。 Versuchen Sie»apt-get -f install«ohne Angabe eines Pakets(oder geben Sie eineLösungan)。

这样做

apt-get下载libudev0 libudev0:i386

sudo dpkg -i libudev0 _ *。deb

sudo apt-get升级

这对我来说是有效的:

  1. sudo apt-mark hold libudev0:i386
  2. sudo apt-mark hold libudev0
  3. sudo apt-get升级
  4. 然后,我进入突触,并标记libudev升级(有可能会通过命令行,以及我只是不这样做了)