Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ubuntu

usb

udev

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

like image 740
JohnA Avatar asked Jun 19 '13 00:06

JohnA


2 Answers

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

like image 82
JohnA Avatar answered Jan 03 '23 19:01

JohnA


Nope. Does not work like a charm.

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

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

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

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

Paketlisten werden gelesen... Fertig

Abhängigkeitsbaum wird aufgebaut

Statusinformationen werden eingelesen... Fertig

libudev-dev ist schon die neueste Version.

Probieren Sie »apt-get -f install«, um dies zu korrigieren:

Die folgenden Pakete haben unerfüllte Abhängigkeiten:

libudev-dev : Hängt ab 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üllte Abhängigkeiten. Versuchen Sie »apt-get -f install« ohne Angabe eines Pakets (oder geben Sie eine Lösung an).

THIS DID:

apt-get download libudev0 libudev0:i386

sudo dpkg -i libudev0_*.deb

sudo apt-get upgrade

like image 41
alphanerd Avatar answered Jan 03 '23 20:01

alphanerd