[Awesome WM] Issue using "vicious" module

Ok, I have been browsing this forum (and others) looking for a solution to my problem, but I didn't find anything relevant, so maybe someone will be able to help me out. Like the title suggests, I have some issues with the "vicious" module for using widgets in the Awesome Window Manager.

There is a version of that module that have been ported by Richard Kolkovich, and available in his git repo.

The problem is that when I try to replicate the basic widgets in the begginer's tutorial in Awesome's site, I get this error: http://git.sigil.org/vicious-fbsd/

Code:
W: awesome: luaA_dofunction:108: error while running function 
stack traceback:
        /home/gwb/.config/awesome/vicious/net.lua:43: in function </home/gwb/.config/awesome/vicious/net.lua:38>
        (tail call): ?
        /home/gwb/.config/awesome/vicious/init.lua:246: in function 'update'
        /home/gwb/.config/awesome/vicious/init.lua:90: in function </home/gwb/.config/awesome/vicious/init.lua:89>
error: /home/gwb/.config/awesome/vicious/net.lua:43: attempt to index local 'f' (a nil value)
W: awesome: luaA_dofunction:108: error while running function
stack traceback:
        /home/gwb/.config/awesome/vicious/net.lua:43: in function </home/gwb/.config/awesome/vicious/net.lua:38>
        (tail call): ?
        /home/gwb/.config/awesome/vicious/init.lua:246: in function 'update'
        /home/gwb/.config/awesome/vicious/init.lua:90: in function </home/gwb/.config/awesome/vicious/init.lua:89>
error: /home/gwb/.config/awesome/vicious/net.lua:43: attempt to index local 'f' (a nil value)
W: awesome: luaA_dofunction:108: error while running function
stack traceback:
        /home/gwb/.config/awesome/vicious/net.lua:43: in function </home/gwb/.config/awesome/vicious/net.lua:38>
        (tail call): ?
        /home/gwb/.config/awesome/vicious/init.lua:246: in function 'update'
        /home/gwb/.config/awesome/vicious/init.lua:90: in function </home/gwb/.config/awesome/vicious/init.lua:89>
error: /home/gwb/.config/awesome/vicious/net.lua:43: attempt to index local 'f' (a nil value)
W: awesome: luaA_dofunction:108: error while running function
stack traceback:
        /home/gwb/.config/awesome/vicious/net.lua:43: in function </home/gwb/.config/awesome/vicious/net.lua:38>
        (tail call): ?
        /home/gwb/.config/awesome/vicious/init.lua:246: in function 'update'
        /home/gwb/.config/awesome/vicious/init.lua:90: in function </home/gwb/.config/awesome/vicious/init.lua:89>
error: /home/gwb/.config/awesome/vicious/net.lua:43: attempt to index local 'f' (a nil value)
^C
waiting for X server to shut down .E: awesome: main:445: cannot open display

As you can see, the problem stems from the vicious module, but since I am not very familiar with Lua, I don't how to fix it. Does anyone ever experimented similar issues with Awesome?

Thank you,
 
That really isn't much of a port of vicious since a lot of errors still exist. This is because the problem with vicious is that it relies heavily upon the linux /proc which supplies information such as cpufreq and mem usage. In freebsd /proc doesn't give the same type of information and as such the vicious net widget fails because its trying to open up /proc/net/dev which doesn't exist.

A quick fix if you have linprocfs mounted is to simply open up the net.lua file in your vicious directory and change the line
Code:
local f = io.open("/proc/net/dev")
to
Code:
local f = io.open("/compat/linux/proc/net/dev")
The same applies to every widget which tries to use /proc/* in which you simply replace it with /compat/linux/proc/*. I think this applies to the mem.lua, cpu.lua, and load.lua files in your vicious directory. There might be others but these are just the ones that come to me off the top of my head.

The proper way to fix this would be replace all the code using /proc and instead get the information from sysctl or some other means but the use of linprocfs should work well enough. If you're still not satisfied you can always try out bashets or obvious (probably plagued by the same problems as vicious).
 
OP
G

gwb

Thank you so much for your answer, it did help me much.

The errors I was getting finally disappeared, and my Awesome stopped crashing when using Vicious. Now I have a different problem: the data printed by Vicious look incoherent. For instance, the traffic shown by the net widget is always 0, even when I try to download. As for the mem usage, I tried to convert the figure shown in every possible unit, but It is still utterly incoherent.. Do you think it has something to do with linproc?

Actually, I mounted /usr/compat/linux/proc, instead of /compat/linux/proc (like they said in the handbook), can it be a cause of trouble? Is there anything to do to setup linproc except from loading linux module and running the linprocfs command? (I tried to look on google with no success..)

Thank you for your time,
 
I just checked out the net widget and it won't work with linproc since linproc doesn't record net usage. You can check yourself by typing in the command
Code:
cat /usr/compat/linux/proc/net/dev
For me it outputs eth0 and lo0, both of which are linux devices so you're not going to get any data. If you want a net widget you're either going to have to write a lua widget or use a shell script.

The mem widget with linproc on the other hand should work though since I've used it successfully several times. Try posting your rc.lua and we can make sure that you have it set up right. As for where you mounted linproc it doesn't really matter as long as you point to the right directory in the vicious widgets.
 
well, from my experiences the modules are mostly written for linux (this gets clear pretty fast for the net widget as well, as there is severals "eth0")
 
OP
G

gwb

yeah, you're right.
Anyway, I have given up hacking the Vicious library for now, and I am currently building my own hardware monitoring module for Awesome. I use essentially sysctl as suggested by SaintOfCloud to get the information, and then I add it by hand on the widgets. I have already written the Temperature and Battery monitoring scripts, and included them in my config... and it works.

What is really amazing with this WM is the ability it gives you to communicate with it dynamically thanks to awesome-client. So what I am doing is starting a script in background, that fetches the informations I need every 5 sec or so, and send them via awesome-client.

Thanks for your help!
 
Top