Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 11942  / 2 Years ago, mon, january 24, 2022, 6:09:47

I had a problem with displaying wifi signal strength and IP in conky (though downloaded and uploaded amounts and DL/UP bitrates were getting displayed). I use a Dell Studio 1535 laptop with a broadcom wireless adapter (BCM4312). After googling for a while and being unable to find a solution, I thought it might be beneficial to share my experience of resolving this problem. It's worth to mention that I use Linux Mint 15 64 bit, which is based on Ubuntu (repositories and everything), therefore I think this must apply to Ubuntu as well.


More From » wireless

 Answers
7

There were 2 issues: conky permissions, and network interface (NIC) name.
The short summary is:




  1. run this command to give Conky the needed permissions:



    sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/conky

  2. Rename your wireless NIC from eth1 to wlan0. Here is how.




Why?



Some people had suggested (in their websites) that the problem might be with the boradcom wireless adapter, which blocks conky request to get the adapter's info, but since the command-line tool iwlist was able to get the list of wireless networks in my neighborhood, I doubted that blocking requests would be the issue, though another command line tool iwspy was unable to get info.



You can get a detailed list of wireless networks in your neighborhood using the command-line tool iwlist:



iwlist eth1 scan


Indeed, one of the issues was this lack of having appropriate root user priviledges. Apparently, Conky needs to have root priviledges to access network libraries and functionalities. If you don't want to run conky with root priviledges, there is a way (since Linux kernel 2.2) to give programs the priviledges they need without running them under root priviledges. You can give any program (its executable binary file) partial root priviledges for performing specific functionalities (eg. network functionalities, filesystem functionalities, etc). This is fully explained in this man page, and partially here. So, we need to delegate (to Conky's binary file) the appropriate root priviledges to perform network-related tasks and to capture raw packets from wire/wireless adapter. In other words, tasks are categorized into different categories of priviledges. Two of these access categories (which conky needs them) are called cap_net_admin and cap_net_raw. We need to give conky these classes of permission. This is done by the following command (source: here):



sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/conky


In addition to this permission issue, a reply to a topic gave me a clue that the name of my network interface card (NIC) (in this case my wireless adapter) might be the source of the problem, since conky "assumes" that the interface names starting with "eth" (eth1, in my case) are ethernet (cable) network cards and thus, these cards are not supposed to represent signal strength. Although the clue was very precious, but no solution was offered there in the above-mentioned topic. I thought renaming the interface may resolve the problem, and indeed it did! I renamed wireless interface (which was named eth1 by default) to wlan0. Here, you can find how to rename a network interface card in Linux. Just note that in that article, they renamed the interface to "wan0", I renamed it to wlan0.



And here is the network part of my .conkyrc config file:



${if_existing /proc/net/route eth0}
${voffset -6}${font PizzaDude Bullets:size=14}O${font} Up: ${upspeed eth0} kb/s
${alignr}${upspeedgraph eth0 8,60}
${voffset 4}${font PizzaDude Bullets:size=14}U${font} Down: ${downspeed eth0} kb/s ${alignr}${downspeedgraph eth0 8,60}
${voffset 4}${font PizzaDude Bullets:size=14}N${font} Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDude Bullets:size=14}T${font} Download: ${alignr}${totaldown eth0}
${voffset 4}${font PizzaDude Bullets:size=14}Z${font} Signal: ${wireless_link_qual eth0}% ${alignr}${wireless_link_bar 8,60 eth0}
${voffset 4}${font PizzaDude Bullets:size=14}a${font} Local Ip: ${alignr}${addr eth0}
${voffset 4}${font PizzaDude Bullets:size=14}b${font} Public Ip: ${alignr} ${execi 3600 wget -O - http://ip.tupeux.com | tail}
${else if_existing /proc/net/route wlan0} ${voffset 4}${font PizzaDude Bullets:size=14}Z${font} Signal: ${wireless_link_qual wlan0}% ${alignr}${wireless_link_bar 8,60 wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}O${font} Up: ${upspeed wlan0} kb/s ${alignr}${upspeedgraph wlan0 8,60}
${voffset 4}${font PizzaDude Bullets:size=14}U${font} Down: ${downspeed wlan0} kb/s ${alignr}${downspeedgraph wlan0 8,60}
${voffset 4}${font PizzaDude Bullets:size=14}N${font} Upload: ${alignr}${totalup wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}T${font} Download: ${alignr}${totaldown wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}a${font} Local Ip: ${alignr}${addr wlan0}
${voffset 4}${font PizzaDude Bullets:size=14}b${font} Public Ip: ${alignr} ${execi 3600 wget -O - http://ip.tupeux.com | tail}
${endif}


And finally here is some extra commands for displaying and removing capabilities (partial and categorized root priviledges) of (executable/binary) files:



You can find out the permissions that each file has by running the following command:



getcap filepath/filename


And remove all permissions (capabilities) of a file:



setcap -r filepath/filename

[#29257] Monday, January 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kneducator

Total Points: 226
Total Questions: 111
Total Answers: 108

Location: Mexico
Member since Sun, Jul 25, 2021
3 Years ago
kneducator questions
Tue, Dec 6, 22, 09:22, 1 Year ago
Sun, Apr 30, 23, 23:26, 1 Year ago
Tue, Jun 8, 21, 01:25, 3 Years ago
Sun, Mar 12, 23, 10:51, 1 Year ago
;