ubuntu 12.04 libudev-dev因为依赖而无法安装

我有一些示例c代码,使用udev库接收hotplug事件.它在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,但已经存在,所以……下一步是什么?

请注意,sources.list中未注释以下repos,我已完成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 to remove and 0 not upgraded.

找到了一个很好的链接
@L_502_0@
但没有快乐.

谷歌说这对其他人来说是一个扣篮……

感谢您的帮助,
约翰

这是解决方案.

当您阅读以下内容时:

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的存储库.

解决这个问题:

>转到http://packages.ubuntu.com搜索“libudev-dev”
>在结果列表中找到175-0ubuntu9.3 for Precise Pangolin(ubuntu 12.04).在这种情况下,该版本在“exact-udpates”下.您可以点击链接

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

显示了您想要了解的有关libudev-dev的所有信息.除了它没有显示我应该使用的确切回购网址!所以我要稍微猜一下……
>添加repos到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

>刷新

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

>安装包:

sudo apt-get install libudev-dev

这就像一个魅力!

约翰

相关文章

1.安装过程出现0x00000000指令引用的0x00000000内存该内存不能为written 如果你安装的是inux系统 需要在...
写在全面:如果根据以下教程涉及到只读文件需要更改文件权限才能需修改文件内容,参考我的另一篇博客:...
写在前面:以下步骤中需要在终端输入命令,电脑端查看博客的朋友可以直接复制粘贴到终端,手机端查看的...
ubuntu16.04和18.04更换国内源 写在前面:安装好ubuntu双系统后,默认的软件更新源是国外的,在国内使用...
ubuntu双系统启动时卡死解决办法(在ubuntu16.04和18.04测试无误) 问题描述: 在安装完ubuntu双系统后...
又来造轮子了。。。。。。。。。。。。。。。。 今天使用w3af向文件中写入的时候,发现没有write权限,...