libevent-2.0.so.5: cannot open shared object file: No such file or directory

When installing Memcached on a machine I came across the following error when I tried to start it:

memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

The solution for this on Debian/Ubuntu (and probably most other linux distros) is this…

On a 32 bit system:

ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

On a 64 bit system:

ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

After creating the appropriate symlink for your system you should now be able to start memcached as normal:

memcached -d -u memcached_user -m 256 127.0.0.1 -p 11211

29 Replies to “libevent-2.0.so.5: cannot open shared object file: No such file or directory”

  1. Ditto on Casey and Tim; this fix worked beautifully on Slackware 14, and.borken tmux is now worken tmux. I’m thrilled the first Google result was actually a fifteen-second fix.

    Thanks so much Nigel. Cheers!

  2. You could also just add the library path to your LD_LIBRARY_PATH environment variable. Assuming you’re using the bash shell, you can edit $HOME/.bashrc and add the following line to it:

    LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
    export LD_LIBRARY_PATH

    This way any other libraries that get installed in /usr/local/lib can be used without having to create symlinks every time a new library is installed.

  3. Another way on Red Hat is to create a new .conf file under /etc/ld.so.conf.d/ with a single line pointing to /usr/local/lib and then running ldconfig.
    Under /etc, there’s a ld.so.conf file that includes *.conf under /etc/ld/so/conf/d/
    This is a nice way to add library lookup paths in a way that reminds you why you have added a specific path (by properly naming the file).

Leave a Reply

Your email address will not be published. Required fields are marked *