Eventually /dev/null

Random thoughts from an emerging Programmer

Mongosniff: Error While Loading Shared Libraries: libpcap.so.0.9

Lately I’ve worked with mongoDB which is a great NoSQL database. A tool which can come in handy is mongosniff, which comes with mongodb binaries. Mongosniff is something like tcpdump for TCP/IP.
On my Fedora 16 x86_64 System I’m running mongodb binaries available from mongodb, this allows me to easily run the version I want. But mongosniff didn’t worked right out the box for it. When starting mongosniff I got following error: mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory. So this mostly means that libpcap isn’t installed, but this wasn’t the case as you can see soon.
My first try was to install libpcap for my system but this didn’t solve the problem. A lookup with ldd showed that indeed libpcap.so.0.9 was missing for it:

1
2
3
4
5
6
7
8
9
$: ldd /usr/bin/mongosniff
       linux-vdso.so.1 =>  (0x00007fffa30d2000)
       libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003ef0400000)
       libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003655a00000)
       libpcap.so.0.9 => not found
       libm.so.6 => /lib64/libm.so.6 (0x0000003ef1000000)
       libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003654600000)
       libc.so.6 => /lib64/libc.so.6 (0x0000003ef0000000)
       /lib64/ld-linux-x86-64.so.2 (0x0000003eefc00000)

A check if any libpcap module was available showed that a too new version was installed and that a symlink as libpcap.so.0.9 was missing:

1
2
3
4
$: ls /usr/lib64/libpcap*
/usr/lib64/libpcapnav.so        /usr/lib64/libpcapnav.so.0
/usr/lib64/libpcap.so.1         /usr/lib64/libpcapnav.so.0.0.0
/usr/lib64/libpcap.so.1.1.1     /usr/lib64/libpcap.so

So creating a symlink for libpcap.so.0.9 solved the startup problem: ln -s /usr/lib64/libpcap.so.1.1.1 /usr/lib64/libpcap.so.0.9. If you’re running a 32bit mongodb version you may check your /usr/lib to see if the required libpcap is missing. Don’t know if this problem still exists if you’re running mongodb from the offical repositoy.