Skip to content

Unable to get system boot time due to unexpected format in /proc/cpuinfo

On a Renesas SH-7785LCR SuperH evaluation board, the command ps aux fails due to an unexpected format in /proc/cpuinfo:

root@tirpitz:~> uname -a
Linux tirpitz 6.2.0 #2 PREEMPT Tue Feb 28 09:23:03 UTC 2023 sh4a GNU/Linux
root@tirpitz:~> cat /proc/cpuinfo
machine         : SH7785LCR
processor       : 0
cpu family      : sh4a
cpu type        : SH7785
cut             : 7.x
cpu flags       : fpu perfctr llsc
cache type      : split (harvard)
icache size     : 32KiB (4-way)
dcache size     : 32KiB (4-way)
address sizes   : 32 bits physical
bogomips        : 599.99
root@tirpitz:~> ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.4  1.2  35484  6592 ?        Ssps: Unable to get system boot time
root@tirpitz:~>

This can be worked around by writing the contents of /proc/cpuinfo into a file, adding a newline and bind-mounting this file to /proc/cpuinfo:

root@tirpitz:~> cat /proc/cpuinfo > /root/cpuinfo
root@tirpitz:~> echo "" >> /root/cpuinfo 
root@tirpitz:~> mount -o bind /root/cpuinfo /proc/cpuinfo
root@tirpitz:~> ps aux | head -n10
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.4  1.2  35484  6600 ?        Ss   10:29   0:18 /sbin/init
root         2  0.0  0.0      0     0 ?        S    10:29   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        I<   10:29   0:00 [rcu_gp]
root         4  0.0  0.0      0     0 ?        I<   10:29   0:00 [rcu_par_gp]
root         6  0.0  0.0      0     0 ?        I<   10:29   0:00 [kworker/0:0H-events_highpri]
root         8  0.0  0.0      0     0 ?        I<   10:29   0:00 [mm_percpu_wq]
root         9  0.0  0.0      0     0 ?        S    10:29   0:00 [ksoftirqd/0]
root        10  0.0  0.0      0     0 ?        I    10:29   0:00 [rcu_preempt]
root        11  0.0  0.0      0     0 ?        S    10:29   0:00 [kdevtmpfs]
root@tirpitz:~>
Edited by John Paul Adrian Glaubitz