Skip to content

Cpu command not able to handle offline cpu cores #7997

@ArjanSchouten

Description

@ArjanSchouten

Creating a bug report/issue

  • I have searched the existing open and closed issues

Required Information

  • DietPi version:
G_DIETPI_VERSION_CORE=10
G_DIETPI_VERSION_SUB=1
G_DIETPI_VERSION_RC=2
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
  • Distro version: trixie
  • Kernel version: Linux dietpi-1 6.1.115-vendor-rk35xx #1 SMP Thu Feb 19 18:09:57 UTC 2026 aarch64 GNU/Linux
  • SBC model : Orange Pi 5 Max (aarch64)

When some cores are disabled, the cpu command outputs a warning which doesn't break things but I think we can handle this case better:

/boot/dietpi/dietpi-cpuinfo: line 32: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 33: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 34: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 32: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 33: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 34: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 32: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 33: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 34: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 32: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 33: read: read error: 0: Device or resource busy
/boot/dietpi/dietpi-cpuinfo: line 34: read: read error: 0: Device or resource busy

 ─────────────────────────────────────────────────────
 DietPi CPU Info
 Use dietpi-config to change CPU / performance options
 ─────────────────────────────────────────────────────
 Architecture |     aarch64
 Temperature  |     49 °C / 120 °F : Optimal temperature
 Governor     |     schedutil

                 Current Freq    Min Freq   Max Freq
 CPU0         |      1608 MHz      1008 MHz    1800 MHz
 CPU1         |      1608 MHz      1008 MHz    1800 MHz
 CPU2         |      1608 MHz      1008 MHz    1800 MHz
 CPU3         |      1608 MHz      1008 MHz    1800 MHz

[ INFO ] DietPi-CPU_info | The current CPU frequency may be affected by processing this script itself.

Steps to reproduce

  1. echo 0 | sudo tee /sys/devices/system/cpu/cpu4/online
  2. cpu

Expected behaviour

  • The offline cpu's are ignored (or just like htop does, report that the cpu is offline).

Actual behaviour

/boot/dietpi/dietpi-cpuinfo: line 32: read: read error: 0: Device or resource busy

If I've time I can give it a try to fix this. It is basically checking cat /sys/devices/system/cpu/cpu4/online for every cpu before these checks:

[[ -f /sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq ]] && read -r aCPU_CUR_FREQ["$i"] < "/sys/devices/system/cpu/cpu$i/cpufreq/scaling_cur_freq"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions