Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
426 views
in Technique[技术] by (71.8m points)

usb - ubuntu 12.04 libudev-dev won't install because of dependencies

I have a some sample c++ code that receives hotplug events using the udev library. It worked fine in Ubuntu 10.04. It's only prerequisite was the libudev-dev package: sudo apt-get install libudev-dev

But when I tried to install that package in 12.04, I get:

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.

This seems to imply I should install libudev0, so:

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.

I'm not sure how to proceed from here. libudev-dev depends on libudev0 but that's already in place, so ... what's next?

Note that the following repos are un-commented in sources.list and I've done an apt-get update:

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

Some sites have indicated I should do -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.

Found an excellent link here: https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies but no joy.

Google says that this is a slam dunk for other folks out there...

Thanks for any help on this, John

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here's the solution.

When you read the following:

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.

it means that the libudev-dev package I am trying to install depends on package:

libudev0 version 175-0ubuntu9

(That's what the "(= 175-0ubuntu9)" is trying to say)

But libudev0 version 175-0ubuntu9.3 has been already installed.

(That's what the "but 175-0ubuntu9.3 is to be installed" is trying to say).

So in other words:

  • a newer version of libudev0 is already installed.
  • the libudev-dev package I am trying to install depends on an older version of libudev0 older and it is already installed.
  • which in turn means that the repository I am installing libudev-dev from is out of date.

You can find the packages available in all of the repositories you currently have listed in /etc/apt/sources.list by:

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

So finally we get to the REAL problem! My list of repositories in sources.list is missing the one which contains libudev-dev 175-0ubuntu9.3.

To fix it:

  1. go to http://packages.ubuntu.com and search for "libudev-dev"

  2. In the resulting list find 175-0ubuntu9.3 for the Precise Pangolin (ubuntu 12.04). In this case that version is under "precise-udpates". You can click on the link:

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

    which shows everything you wanted to know about libudev-dev. Except it doesn't show the exact repo url I should use! So I'm going to take a bit of a guess...

  3. add repos to 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. refresh

    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. install the package:

    sudo apt-get install libudev-dev
    

    which works like a charm!

John


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...