[DOCS-526] mongosniff: depends strictly on libpcap versions, fixing Created: 15/Sep/12  Updated: 08/Nov/12  Resolved: 08/Nov/12

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Adam Comerford Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux, libpcap > 0.9


Issue Links:
Related
Participants:
Days since reply: 11 years, 14 weeks, 6 days ago

 Description   

This came up recently (will link relevant issues). The resolution is to symlink the older version manually to the newer version. Error looks like this:

[root@host /]# ./bin/mongosniff 
/opt/data/mongodb/install/bin/mongosniff: error while loading shared libraries: libpcap.so.0.9: cannot open shared object file: No such file or directory

This happens even when a newer version of libpcap is installed (1.0 for example). The resolution is to symlink the missing dependency to the newer version somewhere in the LD_LIBRARY_PATH

The easiest way to do this is to symlink the old version in the same folder as the newer version:

[root@host lib64]# cd /path/to/lib/libpcap.so.1.0.0
[root@host lib64]# ln -s libpcap.so.1.0.0 libpcap.so.1.0.0 libpcap.so.0.9
[root@host lib64]# ls -l libpcap.so*
lrwxrwxrwx  1 root root     16 Sep 15 08:50 libpcap.so.0.9 -> libpcap.so.1.0.0
lrwxrwxrwx. 1 root root     16 Jul 26 21:39 libpcap.so.1 -> libpcap.so.1.0.0
-rwxr-xr-x  1 root root 225808 Nov 11  2010 libpcap.so.1.0.0



 Comments   
Comment by auto [ 08/Nov/12 ]

Author:

{u'date': u'2012-11-08T16:41:32Z', u'email': u'samk@10gen.com', u'name': u'Sam Kleinman'}

Message: DOCS-526: correction to the mongosniff libpcap note
Branch: master
https://github.com/mongodb/docs/commit/bb8a5c400d8ca61550fb47ded045638b81ea9a1e

Comment by Adam Comerford [ 08/Nov/12 ]

samk mongosniff does not have to be compiled - it is distributed as part of the binaries on the downloads page. As proof, here is the output of the folder where I keep various versions - straight extracts of the archives:

$ pwd
/Users/adam/mongo
$ find . -name mongosniff
./1.8.1/bin/mongosniff
./1.8.5/bin/mongosniff
./2.0.0/bin/mongosniff
./2.0.1/bin/mongosniff
./2.0.2/bin/mongosniff
./2.0.3/bin/mongosniff
./2.0.4/bin/mongosniff
./2.0.5/bin/mongosniff
./2.0.6/bin/mongosniff
./2.2.0/bin/mongosniff
./2.2.1/bin/mongosniff

Granted, that is on a Mac - here is the release 2.2.1 64 bit Linux download contents:

~/mongo/mongodb-linux-x86_64-2.2.1/bin$ ls -la 
total 133612
drwxrwxr-x 2 adam adam     4096 Nov  8 21:47 .
drwxrwxr-x 3 adam adam     4096 Nov  8 21:47 ..
-rwxr-xr-x 1 adam adam 10450128 Oct 30 12:24 bsondump
-rwxr-xr-x 1 adam adam  4315016 Oct 30 12:24 mongo
-rwxr-xr-x 1 adam adam 10501640 Oct 30 12:24 mongod
-rwxr-xr-x 1 adam adam 10503440 Oct 30 12:23 mongodump
-rwxr-xr-x 1 adam adam 10462448 Oct 30 12:23 mongoexport
-rwxr-xr-x 1 adam adam 10503512 Oct 30 12:24 mongofiles
-rwxr-xr-x 1 adam adam 10478864 Oct 30 12:23 mongoimport
-rwxr-xr-x 1 adam adam 10454224 Oct 30 12:23 mongooplog
-rwxr-xr-x 1 adam adam 10454192 Oct 30 12:24 mongoperf
-rwxr-xr-x 1 adam adam 10499344 Oct 30 12:23 mongorestore
-rwxr-xr-x 1 adam adam  6771008 Oct 30 12:24 mongos
-rwxr-xr-x 1 adam adam 10429344 Oct 30 12:24 mongosniff
-rwxr-xr-x 1 adam adam 10494128 Oct 30 12:23 mongostat
-rwxr-xr-x 1 adam adam 10454224 Oct 30 12:23 mongotop

As you can see, mongosniff is definitely there, and it fails to find libpcap on Ubuntu 12.04 despite it having 2 versions installed:

$ sudo find /usr/lib/ -name libpcap*
/usr/lib/x86_64-linux-gnu/libpcap.so.1.1.1
/usr/lib/x86_64-linux-gnu/libpcap.so.0.8
$ ldd mongosniff
	linux-vdso.so.1 =>  (0x00007fff561b7000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff07e2ea000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff07e0e2000)
	libpcap.so.0.9 => not found
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff07dde1000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff07dae5000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff07d8ce000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff07d50f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007ff07e50d000)

Adam.

Comment by Sam Kleinman (Inactive) [ 07/Nov/12 ]
  • mongosniff must be compiled by users and isn't distributed in our packages, even in the subscriber build.
  • If someone gets mongosniff without compiling, they didn't get it from our distribution (likely an operating system package, which means this linking error is a dependency issue that's beyond our control and the bug needs to be filed with the package maintainer).
  • if it's compiled it should link appropriately, if it doesn't that's a bug in the build process.

Accordingly, closing this ticket. If my reasoning is in error, feel free to reopen.

Cheers,
sam

Generated at Thu Feb 08 07:38:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.