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

Script crashes in CPU class on ARM-based installs #29

Closed
petracvv opened this issue May 12, 2018 · 5 comments · Fixed by #30
Closed

Script crashes in CPU class on ARM-based installs #29

petracvv opened this issue May 12, 2018 · 5 comments · Fixed by #30
Assignees
Labels
bug 🐛 A real glitch has been found

Comments

@petracvv
Copy link

Expected behavior

The archey script will run and display CPU information.

Current behavior

Archey crashes with the following traceback:

[petracvv@archrock lib]$ archey
Traceback (most recent call last):
  File "/usr/bin/archey", line 1081, in <module>
    main()
  File "/usr/bin/archey", line 1075, in main
    output.append(key.name, key.value().value)
  File "/usr/bin/archey", line 836, in __init__
    re.search('(?<=model name\t: ).*', file.read()).group(0)
AttributeError: 'NoneType' object has no attribute 'group'

Possible solution

Parse the lscpu program output instead of /proc/cpuinfo output as the output of /proc/cpuinfo is much less informative on ARM architectures.

Example output of /proc/cpuinfo on my hardware:

[petracvv@archrock lib]$ cat /proc/cpuinfo
processor       : 0
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
BogoMIPS        : 48.00
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Example output of lscpu:

[petracvv@archrock lib]$ lscpu
Architecture:        aarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
Vendor ID:           ARM
Model:               4
Model name:          Cortex-A53
Stepping:            r0p4
CPU max MHz:         1296.0000
CPU min MHz:         408.0000
BogoMIPS:            48.00
L1d cache:           unknown size
L1i cache:           unknown size
L2 cache:            unknown size
Flags:               fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid

Your environment

  • Version used (4.x.y) : 4.4.0
  • Hardware type (Laptop, Server, Raspberry, ...) : Rock64 ARM64 board
  • Operating System and version : ArchARM using a aarch64 build
  • Environment name and version :
  • Connectivity (Off-line, LAN only, Internet access, ...) : Internet access
@HorlogeSkynet
Copy link
Owner

Hi !

Could you rather tell us within which file we may retrieve this information on your architecture / build ?
I think lscpu is not a pre-installed software, and it'd be better if we actually don't add another dependency.

Thanks

@HorlogeSkynet HorlogeSkynet added the bug 🐛 A real glitch has been found label May 12, 2018
@HorlogeSkynet HorlogeSkynet self-assigned this May 12, 2018
@petracvv
Copy link
Author

petracvv commented May 12, 2018

Actually, I think lscpu is installed by default on just about every distribution since it is included in the util-linux package which has essential tools. (https://en.wikipedia.org/wiki/Util-linux)

The only time I think you may not have that command available is in some sort of embedded linux where you have to use BusyBox or other stripped down utilities.

Otherwise, I don't think there are other virtual files like /proc/cpuinfo for getting this information.

EDIT: Based on some more reading this probably only affects ARM architectures, so maybe use /proc/cpuinfo for most but parse lscpu for ARM? (util-linux/util-linux#564)

@HorlogeSkynet
Copy link
Owner

HorlogeSkynet commented May 12, 2018

Thanks for your feedback, I should take a look to it this WE.
Will you be able to try the future workaround on a proper branch once published ?

@petracvv
Copy link
Author

No problem, I'll help out with testing.

@HorlogeSkynet
Copy link
Owner

Closing here as pull request is opened. Please refer to #30.

@HorlogeSkynet HorlogeSkynet moved this from In progress (review are welcome !) to Done in Core May 30, 2018
@HorlogeSkynet HorlogeSkynet removed this from Done in Core May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 A real glitch has been found
2 participants