Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry PI - CPU info is not correct #2616

Closed
nicolargo opened this issue Dec 8, 2023 Discussed in #2615 · 31 comments · Fixed by #2848
Closed

Raspberry PI - CPU info is not correct #2616

nicolargo opened this issue Dec 8, 2023 Discussed in #2615 · 31 comments · Fixed by #2848

Comments

@nicolargo
Copy link
Owner

Discussed in #2615

Originally posted by jslegers73 December 8, 2023
Hello,

image

I have a question what does the 8 mean?

@nicolargo nicolargo added the bug label Dec 8, 2023
@nicolargo nicolargo added this to the Glances 4.0.0 milestone Dec 8, 2023
@nicolargo
Copy link
Owner Author

Perhaps in /proc/device-tree/model ?

@jslegers73 can you have a look ?

@jslegers73
Copy link

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

@lnlyssg
Copy link

lnlyssg commented Mar 27, 2024

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
   [...]

@nicolargo nicolargo modified the milestones: Glances 4.0.0, Next releases Apr 8, 2024
@juanmanuelbc
Copy link

Same here @nicolargo:

imagen

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

@jslegers73
Copy link

Hi,

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

@nicolargo
Copy link
Owner Author

nicolargo commented May 27, 2024

    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
Copy link
Owner Author

Pushed on the develop branch.

Should be ok for Raspberry.

@nicolargo
Copy link
Owner Author

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
Copy link
Owner Author

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

@jslegers73
Copy link

@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.

@nicolargo
Copy link
Owner Author

@jslegers73
Copy link

@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

@nicolargo
Copy link
Owner Author

@jslegers73
Copy link

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

@nicolargo
Copy link
Owner Author

apt install python-dev

@jslegers73
Copy link

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
Copy link

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
Copy link

jslegers73 commented Jun 17, 2024

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.

@lnlyssg
Copy link

lnlyssg commented Jun 17, 2024

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
Copy link

lnlyssg commented Jun 17, 2024

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

@RazCrimson
Copy link
Collaborator

@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.

@jslegers73
Copy link

@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
Copy link

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.

@RazCrimson
Copy link
Collaborator

@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 RazCrimson reopened this Jun 18, 2024
@jslegers73
Copy link

@RazCrimson thank you that did the trick.

This is what I get now :
image

It shows the CPU Frequency.

@RazCrimson
Copy link
Collaborator

@jslegers73

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

@juanmanuelbc
Copy link

juanmanuelbc commented Jun 20, 2024

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...

@jslegers73
Copy link

@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:~ $
`

@RazCrimson
Copy link
Collaborator

RazCrimson commented Jun 21, 2024

@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

@jslegers73
Copy link

Hi I have tried the version but still shows frequency :

image

@jslegers73
Copy link

I can confirm that with the latest version both on a Pi4 and Pi5 it works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants