• Linux
  • April 2018
    M T W T F S S
    « Mar   May »
  • Meta

  • Follow me on Twitter

  • Advertisements


Last month I mentioned that I was working on conkyinfo.sh, a script to gather the device information I needed to use in my conky scripts. Now that I’ve found that my old scripts don’t work so well anymore, I’ve adapted a simpler script that shows less information.

But that doesn’t mean that I’ve tossed that script completely aside. Yesterday, I got to thinking about expanding on that script and gathering some basic system information into a text file stored in the home directory. It turned out that I really didn’t use much from the conkyinfo.sh script.

I set up variables to hold the results of dmidecode commands for general information about the system such as manufacturer, product name and version, and system serial number. I started out using dmidecode to get the CPU model and it worked well with the HP laptop I was using when I originally wrote the script.

While testing it on my desktop PC and my other Linux laptops, I noticed that on my Dell laptops, dmidecode returned ‘Not Specified” for the CPU information so I turned to using grep with the lscpu command to give me the information that I needed. I used grep and awk with /proc/meminfo to give me the amount of physical memory in gigabytes.  All this information was redirected into a file.

For information network interfaces and power (batteries), I redirected the output of the ls command on /sys/class/net and /sys/class/power_supply. For hard drive information I redirected the  lsblk output to the file. At the end of the script I ran the cat command on the file to display everything.


The only problem I’m having is when I run it on my Lenovo ThinkCentre M91p. The variables containing the output of the dmidecode commands all contain an error message: “Invalid entry length (16). Fixed up to 11.” I’m not sure what’s causing it but from what I’ve read about the error, it may have something to do with using sudo with dmidecode. Some articles talked about the host name being too long but even after shortening the host name, I still got the error. Some of the other computers have longer host names. but the error doesn’t occur. I’ve only seen the error when using sudo with dmidecode on the M91p.

Testing on the various machines using ssh and rsync made the process so much easier. With each changed to the script, I had to upload it to each machine and using a script makes that process so much easier when I can upload to all machines with one command.


One Response

  1. After more research I’ve found that there is a bug in the version of dmidecode that ships with Ubuntu 16.04. The bug keeps it from sending error messages to STERR and even affixing 2>/dev/null does not work with it. It appears that I have to live with it for now. About all I can do it edit out the dmidecode error messages from the .info file.

    I added a variable and a line of code to report the Linux distribution on the computer.

Comments are closed.

%d bloggers like this: