glances icon indicating copy to clipboard operation
glances copied to clipboard

Raspberry PI - CPU info is not correct

Open nicolargo opened this issue 1 year ago • 2 comments

Discussed in https://github.com/nicolargo/glances/discussions/2615

Originally posted by jslegers73 December 8, 2023 Hello,

image

I have a question what does the 8 mean?

nicolargo avatar Dec 08 '23 13:12 nicolargo

Perhaps in /proc/device-tree/model ?

@jslegers73 can you have a look ?

nicolargo avatar Dec 08 '23 13:12 nicolargo

@nicolargo this is the result pi@rpi-test:/ $ cat /proc/device-tree/model Raspberry Pi 4 Model B Rev 1.2 pi@rpi-test:/ $

jslegers73 avatar Dec 08 '23 14:12 jslegers73

I have the same issue on an Oracle Cloud VM:

❯ cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 50.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

Obviously not much of this is useful but lscpu does give me a model name, would this be a possible fallback option?:

❯ lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  1
  On-line CPU(s) list:   0
Vendor ID:               ARM
  Model name:            Neoverse-N1
    Model:               1
    Thread(s) per core:  1
    Core(s) per cluster: 1
   [...]

lnlyssg avatar Mar 27 '24 22:03 lnlyssg

Same here @nicolargo:

imagen

pi@raspberrypi:~ $ cat /proc/device-tree/model Raspberry Pi 4 Model B Rev 1.5

juanmanuelbc avatar Apr 10 '24 09:04 juanmanuelbc

Hi,

I have tried the new version 4 and it is still showing the number 8. Just for your info.

jslegers73 avatar May 15 '24 17:05 jslegers73

    def __get_cpu_name(self):
        # Get the CPU name once from the /proc/cpuinfo file
        # TODO: Multisystem...
        try:
            self.cpu_info['cpu_name'] = open('/proc/cpuinfo').readlines()[4].split(':')[1].strip()
        except (FileNotFoundError, PermissionError, IndexError, KeyError, AttributeError):
            self.cpu_info['cpu_name'] = 'CPU'
        return self.cpu_info['cpu_name']

return 8 because /proc/cpuinfo line 5:

CPU architecture: 8

On Raspberry, it is on line 1:

root@kalipi-cj:~# cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Better solution is to grab the first "model name" line.

nicolargo avatar May 27 '24 12:05 nicolargo

Pushed on the develop branch.

Should be ok for Raspberry.

nicolargo avatar Jun 01 '24 16:06 nicolargo

I have the same issue on an Oracle Cloud VM:

❯ cat /proc/cpuinfo
processor	: 0
BogoMIPS	: 50.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x3
CPU part	: 0xd0c
CPU revision	: 1

Obviously not much of this is useful but lscpu does give me a model name, would this be a possible fallback option?:

❯ lscpu
Architecture:            aarch64
  CPU op-mode(s):        32-bit, 64-bit
  Byte Order:            Little Endian
CPU(s):                  1
  On-line CPU(s) list:   0
Vendor ID:               ARM
  Model name:            Neoverse-N1
    Model:               1
    Thread(s) per core:  1
    Core(s) per cluster: 1
   [...]

Not possible to use lscpu because it is language dependent. For example on my french system, it returns:

❯ lscpu
Architecture :                              x86_64
  Mode(s) opératoire(s) des processeurs :   32-bit, 64-bit
  Address sizes:                            39 bits physical, 48 bits virtual
  Boutisme :                                Little Endian
Processeur(s) :                             16
  Liste de processeur(s) en ligne :         0-15
Identifiant constructeur :                  GenuineIntel
  Nom de modèle :                           13th Gen Intel(R) Core(TM) i7-13620H
    Famille de processeur :                 6
    Modèle :                                186
    Thread(s) par cœur :                    2
    Cœur(s) par socket :                    10
...

nicolargo avatar Jun 01 '24 16:06 nicolargo

@jslegers73 can you test the develop branch on your Raspberry and confirm that the issue is can be closed ?

nicolargo avatar Jun 01 '24 16:06 nicolargo

@jslegers73 can you test the develop branch on your Raspberry and confirm that the issue is can be closed ?

Hi @nicolargo I have checked it on both a Raspberry Pi 4 and 5 both are still showing 8. Using version 4.0.7.

jslegers73 avatar Jun 02 '24 13:06 jslegers73

@jslegers73 The version 4.0.7 is not the develop branch (https://github.com/nicolargo/glances/wiki/Install-and-test-Glances-DEVELOP-version)

nicolargo avatar Jun 02 '24 13:06 nicolargo

@nicolargo Sorry for that. I have tried it with your instructions on a clean install of the RPI OS. But I get errors :

pi@rpi-test:~ $ mkdir ~/tmp
cd ~/tmp
git clone -b develop https://github.com/nicolargo/glances.git
cd ~/tmp/glances
git checkout develop
Cloning into 'glances'...
remote: Enumerating objects: 36885, done.
remote: Counting objects: 100% (3869/3869), done.
remote: Compressing objects: 100% (1005/1005), done.
remote: Total 36885 (delta 2612), reused 3575 (delta 2460), pack-reused 33016
Receiving objects: 100% (36885/36885), 40.40 MiB | 23.49 MiB/s, done.
Resolving deltas: 100% (26196/26196), done.
Already on 'develop'
Your branch is up to date with 'origin/develop'.
pi@rpi-test:~/tmp/glances $ cd ~/tmp/glances
make venv
virtualenv -p /usr/bin/python3 venv
make: virtualenv: No such file or directory
make: *** [Makefile:24: venv-full-python] Error 127
pi@rpi-test:~/tmp/glances $ cd ~/tmp/glances
make test
./venv/bin/python ./unittest-core.py
make: ./venv/bin/python: No such file or directory
make: *** [Makefile:67: test-core] Error 127
pi@rpi-test:~/tmp/glances $ cd ~/tmp/glances
make run-webserver
./venv/bin/python -m glances -C ./conf/glances.conf -w
make: ./venv/bin/python: No such file or directory
make: *** [Makefile:267: run-webserver] Error 127

jslegers73 avatar Jun 02 '24 14:06 jslegers73

You miss the first chapter: https://github.com/nicolargo/glances/wiki/Install-and-test-Glances-DEVELOP-version#install-pre-resquisites

nicolargo avatar Jun 02 '24 14:06 nicolargo

This is what I have done.

pi@rpi-test:~ $ pip install --user virtualenv
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
pi@rpi-test:~ $ apt install python-dev
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
pi@rpi-test:~ $ sudo apt install python-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python-dev-is-python3

E: Package 'python-dev' has no installation candidate
pi@rpi-test:~ $ ^C
pi@rpi-test:~ $ sudo apt install python-dev-is-python3
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-6.6.20+rpt-common-rpi linux-headers-6.6.20+rpt-rpi-2712 linux-headers-6.6.20+rpt-rpi-v8
  linux-image-6.6.20+rpt-rpi-2712 linux-image-6.6.20+rpt-rpi-v8 linux-kbuild-6.6.20+rpt
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  python-dev-is-python3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,364 B of archives.
After this operation, 13.3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main arm64 python-dev-is-python3 all 3.11.1-3 [1,364 B]
Fetched 1,364 B in 0s (71.1 kB/s)
Selecting previously unselected package python-dev-is-python3.
(Reading database ... 98836 files and directories currently installed.)
Preparing to unpack .../python-dev-is-python3_3.11.1-3_all.deb ...
Unpacking python-dev-is-python3 (3.11.1-3) ...
Setting up python-dev-is-python3 (3.11.1-3) ...
Processing triggers for man-db (2.11.2-2) ...
pi@rpi-test:~ $ mkdir ~/tmp

jslegers73 avatar Jun 02 '24 15:06 jslegers73

apt install python-dev

nicolargo avatar Jun 02 '24 17:06 nicolargo

Raspberry Bookworm has changed the usage of PIP.

https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/os/using-python.adoc

I will check it with an older version of Raspbian to see if I get it to work. My production is running on bookworm so can't check there.

jslegers73 avatar Jun 03 '24 07:06 jslegers73

I have some issues with running an older version of the OS for my Pi. Still trying to figure out how to fix it.

jslegers73 avatar Jun 05 '24 15:06 jslegers73

I have tried it with python -m venv .env and try the steps but still get the error :

pi@rpi-test:~ $ source .env/bin/activate
(.env) pi@rpi-test:~ $ cd ~/tmp/glances
make venv
virtualenv -p /usr/bin/python3 venv
make: virtualenv: No such file or directory
make: *** [Makefile:24: venv-full-python] Error 127
(.env) pi@rpi-test:~/tmp/glances $

Sorry I can't test it for you.

jslegers73 avatar Jun 17 '24 17:06 jslegers73

I can give it a go on a Pi 2 but is there a way to run the develop version on a different port?

lnlyssg avatar Jun 17 '24 19:06 lnlyssg

Looks good in the terminal version (was showing 0x41 for me) but I can't figure out how to use a different port to test the webserver, however I suspect it's fixed there too: Screenshot 2024-06-17 at 20 05 07

lnlyssg avatar Jun 17 '24 19:06 lnlyssg

@jslegers73 @lnlyssg Thanks to your efforts for testing the fixes.

@jslegers73 The fixes should be available in version 4.0.8, so you can go ahead and use that.

Closing the issue as it's resolved.

RazCrimson avatar Jun 17 '24 23:06 RazCrimson

@jslegers73 @lnlyssg Thanks to your efforts for testing the fixes.

@jslegers73 The fixes should be available in version 4.0.8, so you can go ahead and use that.

Closing the issue as it's resolved.

Hi I have tested it with version 4.0.8 but it still shows an empty CPU

image

And this is on on a raspberry pi 4. But a friend of mine told me I can test it on a docker running bullseye. So I will try that tonight.

jslegers73 avatar Jun 18 '24 05:06 jslegers73

But a friend of mine told me I can test it on a docker running bullseye. So I will try that tonight.

I have tried it on a debian bullseye container but still get the file not found error on the develop version :

make venv virtualenv -p /usr/bin/python3 venv make: virtualenv: No such file or directory make: *** [Makefile:24: venv-full-python] Error 127 (.env) pi@rpi-test:~/tmp/glances $

Sorry that I could not test it.

jslegers73 avatar Jun 18 '24 16:06 jslegers73

@jslegers73

Could you just try the below commands after cloning the repo:

python3 -m venv venv
./venv/bin/python -m pip install -r requirements.txt
./venv/bin/python -m glances

RazCrimson avatar Jun 18 '24 17:06 RazCrimson

@RazCrimson thank you that did the trick.

This is what I get now : image

It shows the CPU Frequency.

jslegers73 avatar Jun 19 '24 16:06 jslegers73

@jslegers73

Could you try cat /proc/cpuinfo and post it's output?

RazCrimson avatar Jun 19 '24 21:06 RazCrimson

Could you try cat /proc/cpuinfo and post it's output?

This is the result on a Raspberry Pi 4:

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 108.00
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 3

processor       : 1
BogoMIPS        : 108.00
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 3

processor       : 2
BogoMIPS        : 108.00
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 3

processor       : 3
BogoMIPS        : 108.00
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 3

Revision        : d03115
Serial          : xxxxxxxxxxxxxxxx
Model           : Raspberry Pi 4 Model B Rev 1.5

Hope it helps @RazCrimson...

juanmanuelbc avatar Jun 20 '24 06:06 juanmanuelbc

@jslegers73

Could you try cat /proc/cpuinfo and post it's output?

This is a Pi 5

`pi@pi-plex:~ $ cat /proc/cpuinfo processor : 0 BogoMIPS : 108.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x4 CPU part : 0xd0b CPU revision : 1

processor : 1 BogoMIPS : 108.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x4 CPU part : 0xd0b CPU revision : 1

processor : 2 BogoMIPS : 108.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x4 CPU part : 0xd0b CPU revision : 1

processor : 3 BogoMIPS : 108.00 Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp CPU implementer : 0x41 CPU architecture: 8 CPU variant : 0x4 CPU part : 0xd0b CPU revision : 1

Revision : c04170 Serial : 3240e748017b01a7 Model : Raspberry Pi 5 Model B Rev 1.0 pi@pi-plex:~ $ `

jslegers73 avatar Jun 21 '24 05:06 jslegers73

@jslegers73 @juanmanuelbc Can any one of you try out the branch https://github.com/nicolargo/glances/tree/2616-raspberry-pi-cpu-info-is-not-correct ?

Here are the steps if you are new to using git:

Just open the cloned repo, run the below before running glances

git fetch
git checkout origin/2616-raspberry-pi-cpu-info-is-not-correct

Ignore any detached HEAD warnings from git caused by the last command and just run glances

To revert back

git checkout develop

RazCrimson avatar Jun 21 '24 21:06 RazCrimson

Hi I have tried the version but still shows frequency :

image

jslegers73 avatar Jun 22 '24 14:06 jslegers73