jaor/xmobar

Wireless plugin signal/quality not displaying

dovej opened this issue · 6 comments

dovej commented

I recently upgraded from debian buster to bullseye. After the upgrade was complete, I restarted and my xmobar wireless widget started malfunctioning. <essid> still displays the correct SSID, however <quality> only displays 0 and <signal> shows -110.0 even though I have a higher signal strength, e.g. iw link displays "signal: -43 dBm".

How can I debug this?

~ xmobar -V
xmobar 0.36

dovej commented

If I run xmobar with superuser privileges, the quality displays correctly, but I never had to run it this way before...

dovej commented

It looks like this is a permissions issue because I'm seeing the same behavior running iwconfig or iw link with/without sudo. I'm stumped though how this was working in xmobar before I upgraded....

How does everyone else handle permissions for getting wireless signal strength in xmobar?

dovej commented

Inline with the above, cat /proc/net/wireless only gives me the labels (no link info) whereas sudo cat /proc/net/wireless gives me the interface and stats.

It looks to me like the debian build for xmobar uses iwlib: https://sources.debian.org/src/xmobar/0.36-2/debian/rules/. I'm not sure why this is the case, as nl80211 should be supported. In fact, I think the fact that I'm getting the ESSID to display is proof that nl80211 is supported. Using iwlib, Wireless.hs (https://github.com/jaor/xmobar/blob/master/src/Xmobar/Plugins/Monitors/Wireless.hs) would normally get the ESSID from /proc/net/wireless, right? In my case, it can't be, as that turns up nothing without superuser. I think what's going on in my case is that it's successfully getting the ESSID from the nl80211 calls at the top, then it's trying to fill in the blanks from /proc/net/wireless at the bottom. This isn't really relevant to my issue, but the debian maintainers should take note if they see this.

I'm guessing my wireless drivers or something took an update as part of bullseye which changed the privileges required to get link stats...

For anyone else with this issue, one possible workaround is to give xmobar net admin capabilities:
sudo setcap CAP_NET_ADMIN=+ep /usr/bin/xmobar
After doing this, xmobar displays the quality correctly for me, like it used to.

This is undesirable as it gives xmobar permissions to do a bunch of other important stuff it doesn't need to, but it's better than giving it full superuser privileges. Another note for the debian maintainers: some solution along these lines might be appropriate as part of the config. It might also be worth mentioning in the xmobar docs.

I'm still curious how other people handle this though. Or is it unusual that I can't usefully cat /proc/net/wireless or otherwise get link signal/quality without sudo? Google suggests that there are at least a few others in that boat.

jaor commented
dovej commented

possibly not a big influence, but that's a few versions behind the
latest release of xmobar.

Yea, so it goes... That's the latest version listed in the debian sources though, including sid.

i'm on debian unstable, amd64, and /proc/net/wireless is readable by all
users, no need to use sudo:

Interesting... I'm starting to think I'm just hitting a bug in debian, though I'm not sure where. I'll close this and try the debian help list.

Thanks for the data point!

dovej commented

Side note, I probably spoke too soon regarding the nl80211 support "proof". I just realized SSID isn't listed in /proc/net/wireless in the first place. But I'm still guessing bullseye and on is ready to make the transition.