User avatar
kraptv
Posts: 8
Joined: Sun Sep 29, 2013 8:14 pm
Location: London, United Kingdom
Contact: ICQ AOL

system-info - my RaspberryPi system summary script

Sun Sep 29, 2013 8:29 pm

Hi gang.

I was a little annoyed that there didn't seem to be an "all in one info" script that would provide info about my RaspberryPi. In this void, I found other scripts doing some of what I was looking for, but not all. Utilities existed for the x86 platform like dmidecode for dmi information (serials, mainboard info, component info), lmsensors or ipmitool for IPMI info (temperatures, voltages), and others.

Hopefully those used to that functionality (or are searching the forums for equivalents) can find use in my script.

Features include:
  • Model A/B detection
    RAM summary detailing how much is split between system and GPU
    System Overvoltage Detection (acts better for hexadecimal hardware revisions now)
    Raw SD Card capacity (fixed for 4GB and 8GB cards showing up as thousands of megabytes)
    Current Temperature in Fahrenheit and Celsius
    CPU core speeds/voltage
    Extra codecs licensed for for GPU offload.
Needs to be run as root and requires bc to be installed (apt-get install bc if you're running Debian or derivates).

Current version is being served out by my RaspberryPi here:

http://skylab.org/~ryan/system-info/

Code (version current as of this post) is as follows:

Code: Select all

#!/bin/bash

VERSION="0.5.6"
# raspberry-pi system information script
# One script that can tell you the RAM config, serial number, SD card size, 
# temperature, and codec entitlements. Work-in-progress!
# Requires bc to for quick calculation. (apt-get install bc on debian)
# questions and comments to kraptv@sdf.org (or post to the rpi web forum!)
# ***** This has only been tested on Raspbian wheezy

# check if run as a normal user - if so, exit.
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
    echo "$0 not running as root!"
    exit
fi

# Annoyingly, users ignore the bc requirement. This should set them straight!
if [ ! -f /usr/bin/bc ]; then
    echo -e "ERROR: bc binary is not installed.\nTry running 'apt-get install bc' on most popular RaspberryPi Linux distributions."
    exit
fi

# calculate the memory allocated based upon the GPU / system split read from
# /boot/config.txt (gpu_mem=64) - use vcgencmd because text file contents may be
# different than actual boot-time memory split allocation!
sysmem=`/opt/vc/bin/vcgencmd get_mem arm  | sed 's/[A-Za-z]*//g' | cut -c 2-`
gpumem=`/opt/vc/bin/vcgencmd get_mem gpu  | sed 's/[A-Za-z]*//g' | cut -c 2-`
totalmem=`expr $sysmem + $gpumem`

# Model A shouldn't have the smsc95xx installed! Return 1 if it's a modelB
modelB=`lsusb -t | grep -c smsc95xx`
rpiSerialNum=`grep Serial /proc/cpuinfo | cut -d " " -f 2`

# Reference: http://elinux.org/RPi_HardwareHistory#Board_Revision_History
# We have alphanumeric CPU revisions. Need to change the greater than logic.
rpiOverVolt=`grep Revision /proc/cpuinfo | cut -d " " -f 2 | tr -d [A-Z][a-z]`

# Start outputting content with script version
echo "*** system-info for raspberry-pi $VERSION ***************************************"
if [ "$modelB" = "1" ]
then
  echo "Model B serial $rpiSerialNum detected with $totalmem MB ($sysmem Sys/$gpumem GPU)"
else
  echo "Model A serial $rpiSerialNum detected with $totalmem MB installed ($sysmem sys / $gpumem gpu split)"
fi

# Raw SD card capacity does not translate to usable space! May need resizing!
# Changed as many users have 4GB and 8GB SD cards and fdisk shows in KBytes
fdiskOutput=`fdisk -l /dev/mmcblk0 | head -n 2 | tail -n 1 | cut -d \  -f 3,4`
echo "SD card raw capacity: ${fdiskOutput:0:-1}"

# Check if overvolted and display warning.
if [ "$rpiOverVolt" -gt "1000" ]
then
  echo "WARNING: Overvoltage has been applied to this system at least once!"
else
  echo " "
fi

echo -n "Firmware version: "
/opt/vc/bin/vcgencmd version | grep -v Broadcom
echo " "
tm=`/opt/vc/bin/vcgencmd measure_temp`
tc=`echo $tm| cut -d '=' -f2 | sed 's/..$//'`
tf=$(echo "scale=1; (1.8*$tc)+32" | bc)
echo -e "temp:\t $tf'F ($tc'C)"
echo " "
#echo -e "temp:\t $(/opt/vc/bin/vcgencmd measure_temp)" ;
for src in arm core v3d uart emmc pixel hdmi ; do echo -e "$src:\t $(/opt/vc/bin/vcgencmd measure_clock $src)" ; done
echo " "
for id in core sdram_c sdram_p ; do echo -e "$id: $(/opt/vc/bin/vcgencmd measure_volts $id)" ; done
echo " "
for codec in MPG2 WVC1 ; do echo -e "$codec:\t $(/opt/vc/bin/vcgencmd codec_enabled $codec)" ; done
this will output something like this on a Model B with a 64GB SD Card (RPi has not had overvoltage applied ):

Code: Select all

*** system-info for raspberry-pi 0.5.6 ***************************************
Model B serial 00000000d2e1bc26 detected with 512 MB (448 Sys/64 GPU)
SD card raw capacity: 63.9 GB
 
Firmware version: Nov 15 2013 14:17:01 
version 162026b1448f491e97e3b3b57cdca29be6a1d61a (tainted) (release)
 
temp:	 116.7'F (47.1'C)
 
arm:	 frequency(45)=900000000
core:	 frequency(1)=250000000
v3d:	 frequency(43)=250000000
uart:	 frequency(22)=3000000
emmc:	 frequency(47)=249999000
pixel:	 frequency(29)=148500000
hdmi:	 frequency(9)=163683000
 
core: volt=1.25V
sdram_c: volt=1.20V
sdram_p: volt=1.23V
 
MPG2:	 MPG2=disabled
WVC1:	 WVC1=disabled
And a Model B with 256GB of RAM, 8GB SD Card, and had overvoltaged applied:

Code: Select all

*** system-info for raspberry-pi 0.5.6 ***************************************
Model B serial 0000000047a27b1d detected with 256 MB (192 Sys/64 GPU)
SD card raw capacity: 7861 MB
WARNING: Overvoltage has been applied to this system at least once!
Firmware version: Nov 15 2013 14:17:01 
version 162026b1448f491e97e3b3b57cdca29be6a1d61a (tainted) (release)
 
temp:	 104.1'F (40.1'C)
 
arm:	 frequency(45)=900000000
core:	 frequency(1)=250000000
v3d:	 frequency(43)=250000000
uart:	 frequency(22)=3000000
emmc:	 frequency(47)=250000000
pixel:	 frequency(29)=0
hdmi:	 frequency(9)=0
 
core: volt=1.25V
sdram_c: volt=1.20V
sdram_p: volt=1.23V
 
MPG2:	 MPG2=disabled
WVC1:	 WVC1=disabled
Your feedback is welcome! I would appreciate it if someone with a Model A could tell me that it has reliably detected their system as a Model A, as I am guessing a little bit on the auto-detection part.
Last edited by kraptv on Fri Nov 09, 2018 10:28 am, edited 2 times in total.

chrissv
Posts: 4
Joined: Thu Nov 14, 2013 1:35 am

Re: system-info - my RaspberryPi system summary script

Thu Nov 14, 2013 1:44 am

Hi there,
I was looking for an e-mail address to reply to you (in the script, on this page, or on your website) but didn't find any. So I am posting my comment here.
I tried your version 0.5.5 of the script and got the following results:

Code: Select all

*** system-info for raspberry-pi 0.5.5 ***************************************
Model B serial 000000005953cfe9 detected with 512 MB (448 Sys/64 GPU)
./system-info.sh: line 47: -1: substring expression < 0
./system-info.sh: line 50: [: 000e: integer expression expected

Firmware version: Nov 12 2013 23:43:03
version 4aee5454c7955e7bc0bbb152ca4c0e26e75376e1 (clean) (release)

temp:    107.9'F (42.2'C)

arm:     frequency(45)=699998000
core:    frequency(1)=250000000
v3d:     frequency(43)=250000000
uart:    frequency(22)=3000000
emmc:    frequency(47)=250000000
pixel:   frequency(29)=108000000
hdmi:    frequency(9)=163682000

core: volt=1.20V
sdram_c: volt=1.20V
sdram_p: volt=1.23V

MPG2:    MPG2=disabled
WVC1:    WVC1=disabled
Apparently your script is expecting the fdisk -l output to contain a "GB" and mine doesn't:

Code: Select all

# fdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0002c262

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15523839     7700480   83  Linux
I don't know about the second error.

My "uname -a" results in:

Code: Select all

Linux rpi 3.10.18+ #594 PREEMPT Wed Nov 13 17:59:34 GMT 2013 armv6l GNU/Linux
Regards - Steven

Honsolgen
Posts: 20
Joined: Mon Nov 25, 2013 8:35 am
Location: Honsolgen - Germany
Contact: Website

Re: system-info - my RaspberryPi system summary script

Mon Nov 25, 2013 11:02 am

[wrong thread --sorry]
Last edited by Honsolgen on Tue Nov 26, 2013 11:34 am, edited 1 time in total.

tvjon
Posts: 710
Joined: Mon Jan 07, 2013 9:11 am

Re: system-info - my RaspberryPi system summary script

Mon Nov 25, 2013 3:15 pm

kraptv wrote:....

Your feedback is welcome! I would appreciate it if someone with a Model A could tell me that it has reliably detected their system as a Model A, as I am guessing a little bit on the auto-detection part.
Thanks, looks useful.

Model A:


*** system-info for raspberry-pi 0.5.5 ***************************************
Model A serial 0000000076ed0a03 detected with 256 MB installed (128 sys / 128 gpu split)
SD card raw capacity: 31.9 GB

Firmware version: Oct 18 2013 16:04:29
version dbda126981820ea5681263042435388dddf65131 (tainted) (release)

temp: 86.7'F (30.4'C)

arm: frequency(45)=700000000
core: frequency(1)=250000000
v3d: frequency(43)=250000000
uart: frequency(22)=3000000
emmc: frequency(47)=100000000
pixel: frequency(29)=148500000
hdmi: frequency(9)=163682000

core: volt=1.20V
sdram_c: volt=1.20V
sdram_p: volt=1.23V

MPG2: MPG2=disabled
WVC1: WVC1=disabled
pi@raspberrypi ~ $

Like other posters though, script errors are reported:

cut: the delimiter must be a single character
Try `cut --help' for more information.
./rpii.sh: line 47: -1: substring expression < 0
./rpii.sh: line 50: [: 100000e: integer expression expected

User avatar
kraptv
Posts: 8
Joined: Sun Sep 29, 2013 8:14 pm
Location: London, United Kingdom
Contact: ICQ AOL

Re: system-info - my RaspberryPi system summary script

Mon Nov 25, 2013 11:31 pm

Thanks for the bug reports (and tests on a Model A), everyone, I have since killed those issues.

Try the latest version!

User avatar
DougieLawson
Posts: 36306
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: system-info - my RaspberryPi system summary script

Mon Nov 25, 2013 11:41 pm

In this (http://www.raspberrypi.org/phpBB3/viewtopic.php?t=58632) Android project we collected the following data items:

Code: Select all

hostname -f
cat /etc/*-release | grep PRETTY_NAME=
uname -mrs
uname -v
cat /sys/class/thermal/thermal_zone0/temp
cat /proc/uptime
cat /proc/meminfo
cat /proc/loadavg
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
df -T | grep -vE \"tmpfs|rootfs|Filesystem|File system\"
You may want to consider adding some of those (that are missing) to your project.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DougieLawson
Posts: 36306
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: system-info - my RaspberryPi system summary script

Mon Nov 25, 2013 11:44 pm

This project http://linuxcounter.net/main.html has been running for many years (and my linux machines have been logging on there). You may want to pull a copy of their code and steal some of their ideas. http://linuxcounter.net/script/lico-update.sh

We can then feed that completed work back to the Linux Counter so they can have a Raspberry Pi version.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
kraptv
Posts: 8
Joined: Sun Sep 29, 2013 8:14 pm
Location: London, United Kingdom
Contact: ICQ AOL

Re: system-info - my RaspberryPi system summary script

Tue Nov 26, 2013 12:01 am

To be honest, I've actually cut out a lot of the stuff with the idea that I'd be able to display it all within a 80x24 terminal window.

I wanted it to be a bit unique to the hardware circumstances rather than simply replace the system utilities like top and uptime.

I suppose I should work on a "verbose" mode for system-info.sh that will give the mother-lode of information as you suggested - might be good for people wanting "system information super-dumps" in case they need to send back some info to someone else, save for posterity, etc!

Thanks for the suggestions.

User avatar
micksulley
Posts: 163
Joined: Sat Mar 03, 2012 11:48 am
Location: Melton Mowbray, England

Re: system-info - my RaspberryPi system summary script

Tue Nov 26, 2013 9:59 am

Very useful, thank you. :D

I was looking for a way to monitor the voltage to my Pi as I have experienced several crashes, but from what I have found it is not possible. Would monitoring the core: volt, sdram_c and sdram_p achieve a similar thing? Should I see these dip if there is a power problem?

Thanks
Mick

User avatar
kraptv
Posts: 8
Joined: Sun Sep 29, 2013 8:14 pm
Location: London, United Kingdom
Contact: ICQ AOL

Re: system-info - my RaspberryPi system summary script

Tue Nov 26, 2013 10:06 am

Hi Mick!

There could be a lot of factors that are feeding into your system's peculiar behaviour. It might be best to start interacting with the vgencmd commands invoked periodically to see if there are major differences.

http://elinux.org/RPI_vcgencmd_usage will show you the various options you can invoke and get information from.

I know I had some instability when I applied CPU overvoltage and was too zealous with my over clock settings, but when I did a more modest overclock, things were much better.

Also - I happened to experience better stability after I upgraded the firmware and kernel configuration. Have you run the rpi-update command on the system lately?

jrwagz
Posts: 1
Joined: Wed Jan 01, 2014 7:05 pm

Re: system-info - my RaspberryPi system summary script

Wed Jan 01, 2014 7:13 pm

Hi @kraptv, great script!

I ran it on my Pi running the SiriProxy image from SourceForge (http://sourceforge.net/projects/siriproxyrpi/) which is based on Raspbian Wheezy, and got a slight error that I was able to easily fix and thought you might want to incorporate:

Here was the original output when running version 0.5.6 of your script:

Code: Select all

root@raspberrypi:/bin# ./system_info
tr: extra operand `dd'
Try `tr --help' for more information.
*** system-info for raspberry-pi 0.5.6 ***************************************
Model B serial 00000000431b1cb9 detected with 256 MB (240 Sys/16 GPU)
SD card raw capacity: 16.1 GB
./system_info: line 53: [: : integer expression expected

Firmware version: Oct 18 2013 16:02:09
version dbda126981820ea5681263042435388dddf65131 (clean) (release)

temp:    115.7'F (46.5'C)

arm:     frequency(45)=700074000
core:    frequency(1)=250000000
v3d:     frequency(43)=250000000
uart:    frequency(22)=3000000
emmc:    frequency(47)=100000000
pixel:   frequency(29)=0
hdmi:    frequency(9)=0

core: volt=1.20V
sdram_c: volt=1.20V
sdram_p: volt=1.23V

MPG2:    MPG2=disabled
WVC1:    WVC1=disabled
I then modified the line where you calculate "rpiOverVolt" to break the "tr" command into two separate commands like so:

Code: Select all

# Reference: http://elinux.org/RPi_HardwareHistory#Board_Revision_History
# We have alphanumeric CPU revisions. Need to change the greater than logic.
rpiOverVolt=`grep Revision /proc/cpuinfo | cut -d " " -f 2 | tr -d [A-Z] | tr -d [a-z]`
It now works without errors:

Code: Select all

root@raspberrypi:~# system_info
*** system-info for raspberry-pi 0.5.6 ***************************************
Model B serial 00000000431b1cb9 detected with 256 MB (240 Sys/16 GPU)
SD card raw capacity: 16.1 GB

Firmware version: Oct 18 2013 16:02:09
version dbda126981820ea5681263042435388dddf65131 (clean) (release)

temp:    111.9'F (44.4'C)

arm:     frequency(45)=700000000
core:    frequency(1)=250000000
v3d:     frequency(43)=250000000
uart:    frequency(22)=3000000
emmc:    frequency(47)=100000000
pixel:   frequency(29)=0
hdmi:    frequency(9)=0

core: volt=1.20V
sdram_c: volt=1.20V
sdram_p: volt=1.23V

MPG2:    MPG2=disabled
WVC1:    WVC1=disabled
Thanks for the handy script!

chrissv
Posts: 4
Joined: Thu Nov 14, 2013 1:35 am

Re: system-info - my RaspberryPi system summary script

Fri Nov 09, 2018 2:05 am

Hi,
Does anyone maintain this script?

I think it needs to be updated for the Pi 3.
The website referenced in the first posting in this thread doesn't work.

User avatar
B.Goode
Posts: 8842
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: system-info - my RaspberryPi system summary script

Fri Nov 09, 2018 9:38 am

chrissv wrote:
Fri Nov 09, 2018 2:05 am
Hi,
Does anyone maintain this script?

I think it needs to be updated for the Pi 3.
The website referenced in the first posting in this thread doesn't work.

The original author, @kraptv has not logged into these forums since 2016 - it is unlikely, though not impossible, that they will see it and reply.

The original version of the script was published in the initial post in this thread. It is therefore possible for you to update it for your own needs, and maybe republish it somewhere like GitHub for the future benefit of other users.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23870
Joined: Sat Jul 30, 2011 7:41 pm

Re: system-info - my RaspberryPi system summary script

Fri Nov 09, 2018 9:40 am

Try this one instead.

https://github.com/raspberrypi/utils/tr ... r/raspinfo

This will be installed as standard on Raspbian at some point, to help with diagnostics.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I think it’s wrong that only one company makes the game Monopoly.” – Steven Wright

Return to “General discussion”