raboof / nethogs

Linux 'net top' tool
GNU General Public License v2.0
3.11k stars 286 forks source link

program execution error... #154

Open Astara opened 6 years ago

Astara commented 6 years ago

nethogs -V version 0.8.0 uname -a Linux Ishtar 4.14.0-Isht-Van #2 SMP Thu Nov 16 02:15:01 PST 2017 x86_64 GNU/Linux

running under SUSE 13.2 base, w/updates

sudo nethogs creating socket failed while establishing local IP - are you root?

??? What socket was it looking for? I'm guessing I don't have some needed kernel module loaded that was expected? I know the docs say it doesn't rely on a special kernel module, but... how about a non-special one? ;-)

Since I compile my own kernel, I only build-in mods needed for my machine to boot and only load ones needed for my HW and normal workflow. The rest usually get loaded automatically as needed, but maybe this prog needed a mod that doesn't load automatically?

Right now I have 445 modules that are not loaded (that could be), 56 dynamic modules loaded and a total of 102 modules listed in /sys/module -- so I think that implies 56 static (built-in) modules. Of the 445, a few may be for some hardware I'm not currently using, but most are not HW-specific.

The README says it's ipv4 only, which is fine, as my machine doesn't have ipv6 connectivity so I don't include it. However, I noticed in the DESIGN doc, it saying it asks to be notified of all IPV4 OR IPV6 TCP packets. Maybe it's trying to open some IPV6 thing?

Though FWIW, if you are trying to find nethogs, wouldn't you want to look at any activity? Not just TCP?

I.e. by looking in /proc/net/dev you could catch all the traffic. FWIW, I have a simple perl-based 'iomon' prog that displays the top network-interfaces, disk-devices and programs only using the /proc interfaces. I wrote it to be able to see quickly where activity was -- what programs, reading/writing to what partitions (or devices) and what network interfaces were being most utilized...(I'll see if I can drop a picture on here -- you can see how primitive it is -- the horizontal scales change based on the amount of traffic..)

Anyway, here's some strace output where it looked like it started failing...

Tried trace, failed part: open("/proc/net/psched", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9d129c7000 read(3, "000003e8 00000040 000f4240 3b9ac"..., 1024) = 36 close(3) = 0 munmap(0x7f9d129c7000, 4096) = 0 futex(0x3004b8705c, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x3004b87068, FUTEX_WAKE_PRIVATE, 2147483647) = 0 ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcf30) = -1 ENOTTY (Inappropriate ioctl for device) getuid() = 0 geteuid() = 0 getgid() = 0 getegid() = 0 getuid() = 0 stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 getuid() = 0 setfsuid(0) = 0 getgid() = 0 setfsgid(0) = 0 access("/usr/share/terminfo/l/linux", R_OK) = 0 open("/usr/share/terminfo/l/linux", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=1794, ...}) = 0 mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9d129b8000 read(3, "\32\1\24\0\35\0\20\0}\1I\3linux|linux console\0"..., 65536) = 1794 read(3, "", 65536) = 0 close(3) = 0 munmap(0x7f9d129b8000, 65536) = 0 geteuid() = 0 setfsuid(0) = 0 getegid() = 0 setfsgid(0) = 0 ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcf30) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bced0) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcea0) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcf20) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcf20) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bcf40) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B0 -opost isig -icanon -echo ...}) = -1 ENOTTY (Inappropriate ioctl for device) rt_sigaction(SIGTSTP, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTSTP, {0x302a217550, [], SA_RESTORER|SA_RESTART, 0x3000c35200}, NULL, 8) = 0 rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {0x302a217470, [], SA_RESTORER|SA_RESTART, 0x3000c35200}, NULL, 8) = 0 rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGTERM, {0x302a217470, [], SA_RESTORER|SA_RESTART, 0x3000c35200}, NULL, 8) = 0 rt_sigaction(SIGWINCH, NULL, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGWINCH, {0x302a217460, [], SA_RESTORER, 0x3000c35200}, NULL, 8) = 0 ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fffaf5bd030) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B0 -opost -isig -icanon -echo ...}) = -1 ENOTTY (Inappropriate ioctl for device) ioctl(2, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B0 -opost isig -icanon -echo ...}) = -1 ENOTTY (Inappropriate ioctl for device) getuid() = 0 socket(PF_INET, SOCKRAW, 0x608 /* IPPROTO??? */) = -1 EINVAL (Invalid argument) write(1, "\33[1;24r\33[0;10m\33[4l\33[?7h\33[24;1H\r", 31^M) = 31 ioctl(2, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B0 -opost -isig -icanon -echo ...}) = -1 ENOTTY (Inappropriate ioctl for device) write(2, "creating socket failed while est"..., 66creating socket failed while establishing local IP - are you root?) = 66 write(2, "\n", 1 ) = 1 exit_group(0) = ? +++ exited with 0 +++

raboof commented 6 years ago

Could you try the latest master?

I agree it would be nice to also monitor non-TCP traffic, but the unique feature of nethogs is that it breaks traffic down per process (not per type), and that is not so easy to do for UDP traffic.