11

I am trying to run an exe which uses libudev.so but it gives this error :

error while loading shared libraries: libudev.so.0: cannot open shared object file: No such file or directory

Running uname -a gives :

3.5.0-44-generic #67~precise1-Ubuntu SMP Wed Nov 13 16:16:57 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I am using Ubuntu 12.04

I have checked /lib /lib32 /lib64 there is no libudev in there but in Synaptic manager I can see libudev0 installed (see image below)

libudev on Synaptic Manager and I could find it in /lib/x86_64-linux-gnu/libudev.so.0.

What could be wrong?

Potherca
  • 13,207
  • 5
  • 76
  • 94
Raulp
  • 7,758
  • 20
  • 93
  • 155
  • Is your 'exe' 32-bit or 64-bit? Try `file my.exe`. If it's a 32-bit executable, it's expected that a 64-bit library is not used for it (then you need to set up a "multiarch" system and install `libudev0:i386` with all its dependencies) – Anton Kovalenko Jan 16 '14 at 04:37
  • file my.exe gives : ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xe561272b6fba244041101a89deb43b9cdf17fe3a, not stripped , Its a 32 bit exe , I will install what you said and try . – Raulp Jan 16 '14 at 04:39
  • 1
    Yes, that's it. If your system is not "multiarch" yet (you know it when package `libudev0:i386` is not found), you may need to configure it. It's done with `dpkg --add-architecture i386` on debian (then `apt-get update`), but it may be different in Ubuntu. – Anton Kovalenko Jan 16 '14 at 04:42
  • libudev0:i386 is installed so I guess its a multiarch! – Raulp Jan 16 '14 at 04:45
  • I have found running a 32 bit exe on Ubuntu we need to install all the dependecies related to 32 bit only.FOr example after installing libudev0:i386 , I ran the app again and got error stating not able to find libQtGui4.so.4 not found , I installed again the i386 version libQtGui4.so (libQtGui4:i386) and app worked. – Raulp Jan 16 '14 at 04:56
  • or better install ia32-libs! – Raulp Jan 16 '14 at 05:04
  • 2
    You can always use `ldd ./my.exe` and see which libraries are missing (then `apt-get install apt-file; apt-file update; apt-file search libSomething.so.42` to know missing packages). @Raulp: it's not that better because it installs a somewhat arbitrary set of "everyday use" libraries, and there's no guarantee that the application doesn't need something extra. `ia32-libs` is obsolete on modern multiarch debian-based distros. – Anton Kovalenko Jan 16 '14 at 05:21
  • @AntonKovalenko: I agree.Thanks for the info!You can paste your explanation in the answer tab! – Raulp Jan 16 '14 at 05:37
  • 1
    yep, posted as an answer (putting all info scattered in my comments together). – Anton Kovalenko Jan 16 '14 at 06:23

4 Answers4

7

It turns out (as I suspected) that you tried to run a 32-bit executable on a 64-bit system. 64-bit Linux kernel is capable of running 32-bit executables (that's why you don't get "exec format error"), but it needs a separate set of (32-bit) libraries: 64-bit version of libudev.so.0 is useless for a 32-bit program. (See ld.so manpage for some details on shared library dependency resolution).

Modern Debian-based distributions support simultaneous library installation for several architectures. apt-get install libudev0:i386 should get a 32-bit version of the library and all its dependencies (there might be plenty of them if it's the first time you use a 32-bit application). If you upgraded from an ancient installation, you might need to add i386 to architectures supported by dpkg, like this:

dpkg --add-architecture i386

Some advices to use if the program needs some other libraries as well:

  • Use ldd to see all the dependencies at once (and what's missing)
  • Install apt-file and run apt-file update, so you can look up a package name by a file name, even if the package is not currently installed (like this: apt-file search /libudev.so.0)

There was also an old Debian way of getting 32-bit libraries on a 64-bit system: ia32-libs package in amd64 repositories provided a set of libraries, conceptually "everything your application might need". Don't use this approach unless you're running Debian squeeze or earlier (or a debian-based distro of the same age). Even when it worked, there was no guarantee that the program doesn't need some other library as well. Ia32-libs was useful when multiarch support was not ready yet, and that was some years ago.

Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69
7

I just followed this instructions and it works just fine.

https://askubuntu.com/questions/369310/how-to-fix-missing-libudev-so-0-for-chrome-to-start-again

sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1.3.5 /usr/lib/libudev.so.0
Community
  • 1
  • 1
Isaac Leal
  • 121
  • 2
  • 2
4

Try creating symbolic link:

sudo ln -s /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0
Ravi Dhoriya ツ
  • 4,435
  • 8
  • 37
  • 48
Weston Ganger
  • 6,324
  • 4
  • 41
  • 39
  • Just in case somebody wold need it, in my case (a different rpm...), for Rosa Linux, it was sudo ln -sf /lib/libudev.so.1 /lib/libudev.so.0 – CodeGust Jan 30 '18 at 21:27
0

I encountered this error while messing around with Orange Pi RK3399 trying to flash firmware from Linux Mint. The solution was in manual for this Pi and given the following command:

sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev libssl-dev pv e2fsprogs build-essential fakeroot devscripts

Not sure but libudev-dev should be enough so the command would be:

sudo apt-get install libudev-dev

Not all those given packages are needed.

pbies
  • 666
  • 11
  • 28