error while loading shared libraries: cannot open shared object file: No such file or directory

EDIT!!! The right way to fix this (and similar problems) is:

emerge gentoolkit
revdep-rebuild -X

It appears that the libexpat problem was caused by Gentoo developers releasing too many updates without cross-checking them.

I got this error in Gentoo, after doing an “emerge world”. I’m using an AMD64 Turion laptop.

/usr/bin/dbus-daemon: error while loading shared libraries: cannot open shared object file: No such file or directory

dbus didn’t start, so hald couldn’t start, and finally kpowersave wasn’t able to read the battery state.

You’ll agree with me that it is pretty annoying if you have a 3h25m battery life laptop.

Here’s how I solved the problem:

1) First of all, I found the path to it’s /usr/lib/

root@smokey# ls -l /usr/lib/libexpat* -rw-r--r-- 1 root root 250620 Oct 29 14:17 /usr/lib/libexpat.a -rw-r--r-- 1 root root    795 Oct 29 14:16 /usr/lib/ lrwxrwxrwx 1 root root     17 Oct 29 14:17 /usr/lib/ -> lrwxrwxrwx 1 root root     17 Oct 29 14:17 /usr/lib/ -> -rwxr-xr-x 1 root root 141456 Oct 29 14:17 /usr/lib/

2) As you can see, there’s no such thing as a in /usr/lib. But there is a referenced by itself. So I made a symbolic link named pointing to

root@smokey#  ln -s /usr/lib/ /usr/lib/

bell.png Be warned: this may not be the right thing to do. I should have checked the configuration file of the dbus daemon, and changed it to reference instead of But as you may guess i was pissed enough to dig deeply into crappy conf files. And what if there was another app requiring You can never guess when a developer/mantainer will fail you.

3) Finally, fire up those lazy dbus and hald daemons:

root@smokey# /etc/init.d/dbus start  * Starting D-BUS system messagebus ... root@smokey# hald start

Tch… That was easy, man. happy And my battery is the best, you’ll never beat me in powersaving.

Contrassegnato da tag , , , , , , ,

23 thoughts on “error while loading shared libraries: cannot open shared object file: No such file or directory

  1. Fred ha detto:

    Hey Seven,

    I had the exact same error message on Gentoo when trying to restart Apache.

    I made a symbolic link like you sugested (I had same versions as you with ls -l) and it worked perfectly.

    Thx !


  2. sevencapitalsins ha detto:

    Strange, isn’t it? I wonder why those apps link themselves to instead of as one would expect.

    Glad it solved your problem.

  3. Rayne ha detto:

    I’m actually having the same issue right now i got it after running out of diskspace on a yum upgrade of Fedora 7 to Fedora 8. I think its what’s causing my lack of Gui currently as well (i’m using lynx :( ) i’ll made the link but i haven’t tried it yet wish me luck!

  4. Rayne ha detto:

    It works got X up and running again and everything.
    its so much better looking this way
    Thanks a bunch.

  5. sevencapitalsins ha detto:

    I’m glad it worked. I ask myself why developers make those crazy things. There must be a reason, surely.

  6. yogA ha detto:

    thx! it worked for me!

  7. Mat ha detto:

    Thanks for this post, I had the same problem on my gentoo server and this fixed it!

  8. MichaelMH ha detto:

    No! You just run “revdep-rebuild”

    This method can break stuff! =(

  9. optimum ha detto:

    thank you sooooooo much, it worked perfectly !! :)

  10. ceban ha detto:

    revdep-rebildnot always work But this method helped me :) durning gentoo installation

  11. sevencapitalsins ha detto:

    smokey luca # revdep-rebuild
    bash: revdep-rebuild: command not found

    So now I ask you: why?

  12. sevencapitalsins ha detto:

    ok i found out by myself…

    emerge gentoolkit

    and now revdep-rebuild is here

  13. holbech ha detto:

    Hi, symlinking could harm your system (or at least other apps)

    Simply copying the file to rename it does the trick

    here for ubuntu

  14. sevencapitalsins ha detto:

    As I said, that may not be the right thing to do,
    and in the comments i have seen that revdep-rebuild is the best :)

    You simply have to rebuild all your dependencies…

    I guess I should edit the post, but I’m lazy.

  15. allergic ha detto:

    I have the same problem. But .. I found in /usr/lib32. Whereas /usr/lib is a symlink to /usr/lib64, so that’s where lives.

    I’m not sure what this means though … anyone have an idea for a cleaner fix?

  16. allergic ha detto:

    Found what appears to be a fix. I don’t know if the first step matters but I saw in a forum that it might be an issue:

    emerge gettext


    revdep-rebuild -X –library

    The so.1 version is in /usr/lib64, while the so.0 version is in /usr/lib32. This worked for me.

  17. allergic ha detto:

    double dash before library

  18. pravat ha detto:

    very informative

  19. Pipo ha detto:

    Thanks a bunch. I had the same problem and you gave the solution!


  20. Andrew ha detto:

    thanks for the help.

  21. Nelson ha detto:

    Thanks! It works perfectly for me!

  22. […] suggested in this link and “error while loading shared libraries, file too short,” but it did not work. Any […]

  23. Please let me know if you’re looking for a author for your site.
    You have some really good posts and I believe I would be a good asset.
    If you ever want to take some of the load off, I’d
    really like to write some articles for your blog in exchange for a link back to mine.
    Please blast me an email if interested. Thanks!


Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di

Stai commentando usando il tuo account Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

%d blogger hanno fatto clic su Mi Piace per questo: