bottom icon indicating copy to clipboard operation
bottom copied to clipboard

bottom requires root to display network activity from different netns

Open learnwayback opened this issue 3 months ago • 5 comments

I had bottom frozen on 0.8.0 for reasons I didn't remember. I unfroze it and discovered why I had it frozen

Bottom fails to display any network activity (all 0's) when launched from a different network namespace.

But it works when it's root.

The change occurred between 0.8 and 0.9 I believe.

learnwayback avatar Sep 28 '25 15:09 learnwayback

I have no idea how to reproduce this (I don't even know what operating system, I guess Linux), could you please provide instructions (or just please follow the bug template format)? If I can't reproduce I have no way of fixing this, unfortunately.

Thanks!

ClementTsang avatar Sep 29 '25 16:09 ClementTsang

Hm, "network namespace" points to an isolated networking environment - I guess that's why? Network information comes from sysinfo and I did bump the version from 0.26.7 to 0.29.0 in between 0.8 and 0.9, maybe something changed? I do see https://github.com/GuillaumeGomez/sysinfo/issues/1053 but this is 0.26.

I can look a bit more but this is likely an upstream crate issue unfortunately. If you could provide a good way to reproduce this I can try to submit an issue/fix upstream (or at least some workaround).

ClementTsang avatar Sep 29 '25 16:09 ClementTsang

I guess Linux in between 0.8 and 0.9, maybe something changed?

On Linux bottom 0.8 still used heim for network usage which reads /proc/net/dev (the manpage says /proc/net is a symlink to self/net that 'exposes information for the network namespace of which the process is a member') instead of reading the statistics usage of the interfaces under /sys/class/net like sysinfo currently does (linked issue states 'setting network namespace will not refresh sysfs').

jamartin9 avatar Sep 30 '25 01:09 jamartin9

Nice catch!

ClementTsang avatar Sep 30 '25 01:09 ClementTsang

as root:

ip netns add test
ip link set eth0 netns test 
ip netns exec test [SUDO drop from root to user] firefox &
ip netns exec test [SUDO drop from root to user] btm

if it's a wireless interface you would need to use iw phy $PHY set netns name test

however, jamartin9 figured out where the problem is, hopefully it can be addressed. though I'm still not sure why running bottom as root 'fixes' the issue.

learnwayback avatar Sep 30 '25 03:09 learnwayback