inxi root commands
greentv
Status: Curious
Joined: 26 Jun 2012
Posts: 5
Reply Quote
I am trying to use dmidecode in conkyrc but I am unable to grep the infos since it requires root. inxi does collect root information without being root. How would I do this?
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
inxi does not use dmidecode unless you are root. And inxi only uses dmidecode if the required /sys drectories are not located. So the assumption is not correct, what inxi does for most modern systems is query /sys directly, then use that data. A pain in the butt by the way, not trivial or easy to do. dmidecode is only a fall back for legacy systems like old redhat installs, added by request.

The only way to get info as a user process from a root command, like hddtemp, is to add it the sudoers list.

But that has to be done on a person by person basis, ie, the person has to add the command/user name to the sudoers list in /etc/sudoers, like this, say, for user fred:

:: Code ::
# in /etc/sudoers
fred ALL = NOPASSWD: /usr/sbin/hddtemp, /usr/bin/file

#then as regular user:
fred~$ sudo hddtemp /dev/sda
/dev/sda: ST380817AS: 35°C

and that's how that works. But really, usually root commands are root commands for a good reason, especially when it comes to regular users running stuff.
Back to top
greentv
Status: Curious
Joined: 26 Jun 2012
Posts: 5
Reply Quote
Thanks for the reply.

So where do you get this infos from?
:: Code ::
Machine:   System: Acer product: Aspire M1200/3200/5200
           Mobo: Acer model: RS740DVF Bios: American Megatrends version: R03-B0L date: 06/16/2008

As a normal user.
All the information is in dmidecode which is only usable as root.
Could you please let me know where to get the information as normal user.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Read my reply, I told you where I got it, I get it directly from the /sys directories.

For specifics, see the function: get_machine_data(), I think that's the name.

dmidecode was only added somewhat recently as a fallback option for very old linuxes that do not have that /sys dmi data. And dmidecode does require root to use, which is why it's only the fallback.
Back to top
greentv
Status: Curious
Joined: 26 Jun 2012
Posts: 5
Reply Quote
ok I found the info in dmesg, that might be a stunt, I have to test it on different systems.
:: Code ::
dmesg grep -i bios |grep -i dmi | gawk '{ print "System: "$4"\t* Model: "$5" "$6"\t* Bios: "$9"\t* Date: "$10"" }'

Only thing a am still unable to find it the bios vendor in my case Phoenix.
Back to top
greentv
Status: Curious
Joined: 26 Jun 2012
Posts: 5
Reply Quote
Thanks /sys/class/dmi/id/ is the one
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
you can never use dmesg for anything because you can't rely on it actually having the data in it.

If you have a kernel ooops it floods dmesg until the buffer or whatever is gone, too bad, would be nice to be able to use it, but I never do in inxi, for anything, it's not the real data of the system, it's just a log of things that have happened, and are happening.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Here's why you can't use dmesg, for example:

:: Code ::
dmesg | grep -i bios |grep -i dmi | gawk '{ print "System: "$4"\t* Model: "$5" "$6"\t* Bios: "$9"\t* Date: "$10"" }'
System: Filled  * Model: By O.E.M.      * Bios: Filled  * Date: By


anyway have fun.

The way inxi does this stuff isn't random, it's all tested with large user data sets, which expose bad assumptions about what data will actually do and look like.
Back to top
greentv
Status: Curious
Joined: 26 Jun 2012
Posts: 5
Reply Quote
Thanks that is exactly why I asked here :)

That is how the setup looks like now. It's a custom usb stick with recover/repair tools. The idea since it will be booted on different computer to have all the main hardware information at startup. When more info is needed ... well there is always inxi.


Back to top
Display posts from previous:   

All times are GMT - 8 Hours