0

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.

Junaid
  • 1,668
  • 7
  • 30
  • 51
  • /system/xbin/tcpdump or /system/bin/tcpdump ? – Jose Antonio Benitez Montero Apr 03 '14 at 10:36
  • it shows only /bin, not /xbin. I copied tcpdump file in /xbin directory and ran that command. It still showed me the same problem. – Junaid Apr 03 '14 at 10:38
  • Check the existence and permission bits of the binary after reboot. Make sure it is built for that system, for example, put it in a temp directory under /data and try it there first, before adding the complication of putting it on a normally read-only partition which may be read-only not just at the file system level, but the underlying driver level as well. – Chris Stratton Jul 24 '14 at 17:13

3 Answers3

1

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.

Junaid
  • 1,668
  • 7
  • 30
  • 51
0

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.

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127
0

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