Question

I have generated a tcpdump file to run on an Android device using this guide. Instead of Fedora, I made this file on Ubuntu 12.04 .

Everything worked smoothly and tcpdump file was produced correctly. I copied tcpdump file at /system/bin/ on Nexus-5 and ran following commands.

> adb shell
# ln -s /system/bin/tcpdump /system/xbin/tcpdump
# chmod 06755 /system/xbin/tcpdump
# reboot

After restarting computer, when I run > adb shell tcpdump -h , I get following error:

/system/bin/sh: tcpdump: No such file or directory

Can someone help me figure out the problem? Thanks!

Edit1:

When I run "tcpdump -h" on my Ubuntu machine on Virtualbox, it shows me following result:

$ tcpdump -h
tcpdump version 4.2.1
libpcap version 1.1.1
Usage: tcpdump [-aAbdDefhHIKlLnNOpqRStuUvxX] [ -B size ] [ -c count ]
        [ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
        [ -i interface ] [ -M secret ]
        [ -r file ] [ -s snaplen ] [ -T type ] [ -w file ]
        [ -W filecount ] [ -y datalinktype ] [ -z command ]
        [ -Z user ] [ expression ]

Then I copy this tcpdump file on Windows-7 host machine and copy it to the device.

Was it helpful?

Solution

It turns out that my tcpdump file was not statically compiled during the process.

After static compilation to include all other files, I still use /system/xbin/tcpdump to make it work.

You can also see comment section of the link above. I explained what went wrong exactly and how I fixed it.

OTHER TIPS

I do now know what went wrong, but the following thing works:

https://github.com/chatch/tcpdump-android

It is a script that downloads, unpacks, configures and builds tcpdump. And yes, you can change the sources and rebuild.

Yes we need to build application statically not with dynamic link. If we run in dynamic link it will shows no such file directory. So u have to run linux test application statically with your cross compiler tool chain and run in your platform like imx6 board

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top