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

Open
nicolargo opened this issue Dec 8, 2023 Discussed in #2615 · 16 comments
Open

Raspberry PI - CPU info is not correct #2616

nicolargo opened this issue Dec 8, 2023 Discussed in #2615 · 16 comments

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 The version 4.0.7 is not the develop branch (https://github.com/nicolargo/glances/wiki/Install-and-test-Glances-DEVELOP-version)

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

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

No branches or pull requests

4 participants