1 1
guidol

research armbianmonitor cpu-temperature broken? -ge: unary operator expected

Recommended Posts

These days i did install on some devices debian buster (via armbian-build-system generated).

 

On the Orange Pi One this did work also fine with the cpu-temperature (showing via armbianmonitor -m)

On a Orange Pi PC2 and a NanoPi K1 Plus this doesnt work.

 

First I did think this is a problem of the dev-image with debian buster where /sys/devices/virtual/thermal/thermal_zone0/temp

doesnt show an output via cat or more - but its filesize does show a 4096 bytes size (also on a working device - and also rights 444 = rrr for the file):

-r--r--r-- 1 root root 4096 May 20 10:47 temp

BUT NOW after a apt update & apt upgrade I also got this "problem" on a NanoPi Neo2 LTS with a stable debian stretch image:
 

Welcome to ARMBIAN 5.85 stable Debian GNU/Linux 9 (stretch) 5.1.0-sunxi64
package bsp-kernel[5.86] u-boot[5.85] dtb[5.86] firmware[5.83] config[5.86]

with armbianmonitor -m the stretch and buster devices does show the following error:

Stop monitoring using [ctrl]-[c]
Time        CPU    load %cpu %sys %usr %nice %io %irq   CPU

11:14:59: 1008MHz  0.22   7%   4%   2%   0%   0%   0%/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected

 

and the devices with this error got these - for me - new error messages about thermal in the dmesg:

[    6.727971] OF: /thermal-zones/cpu-thermal: arguments longer than property
[    6.728007] OF: /thermal-zones/cpu-thermal: arguments longer than property

 

 

armbianmonitor -u for the NanoPi Neo2 LTS: http://ix.io/1JNA

root@npi-neo2-24(192.168.6.24):~# armbianmonitor -u
System diagnosis information will now be uploaded to /usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
/usr/bin/armbianmonitor: line 385: read: read error: 0: Invalid argument
/usr/bin/armbianmonitor: line 386: [: -ge: unary operator expected
http://ix.io/1JNA
Please post the URL in the forum where you've been asked for.

 

Share this post


Link to post
Share on other sites
24 minutes ago, renedis said:

Have you tried to install lm-sensors and run "sensors" to see what sensors are available?


Development/early/testing kernel seems to not provide any data or data is corrupted and our script seems to break in such case ... IMO this is the only problem here. lm-sensors are dump script which reads data at the same location and if data is not present it will also show nothing ... only without this error I presume.

Share this post


Link to post
Share on other sites

@Igor today I did some research and I think I found something ;)

at the Orange Pi One & Zero (H2/H3 CPU) there is only one thermal zone:

find /sys/devices/ -name temp          

/sys/devices/virtual/thermal/thermal_zone0/temp

 

but on the non-temp-working Orange Pi PC2, NanoPi K1 Plus and the NanoPi Neo Core2 (all H5 CPU)

- running armbian stretch (non-dev) or buster (dev) -

there are 2 thermal zones:

find /sys/devices/ -name temp                                       
/sys/devices/virtual/thermal/thermal_zone0/temp
/sys/devices/virtual/thermal/thermal_zone1/temp

 

At the H5 devices the thermal_zone0/temp gives no output which results in the error of armbianmonitor -m

or no temperature display at armbian-login :(

 

BUT thermal_zone0/temp gives (from my sight and the values) the right ouput.

 

So if I remove the "wrong" symbolic link to thermal_zone0 with

rm /etc/armbianmonitor/datasources/soctemp

and create a new link to thermal_zone1 with

ln -s /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp

the temperature is available at armbianmonitor -m and the armbian login.

 

Now my questions:

- is there a thermal_zone to much or shifted (I dont think 1 should be cpu and 1 pmic)?

- is there way to set soctemp permanently to thermal_zone1? ( because after reboot soctemp defaults to thermal_zone0 )

 

putting these 2 commands in /etc/rc.local does make it as temporarly quick&dirty solution possible:

rm /etc/armbianmonitor/datasources/soctemp

ln -s /sys/devices/virtual/thermal/thermal_zone1/temp /etc/armbianmonitor/datasources/soctemp

        

Share this post


Link to post
Share on other sites
On 6/19/2019 at 8:53 AM, renedis said:

Have you tried to install lm-sensors and run "sensors" to see what sensors are available?

Yes - I tested it today, but lm-sensors didnt find the sensors at a working sbc (OPi One & Zero) nor

on a non-working sbc (OPi PC2, NanoPi K1 Plus & Neo Core2).

Share this post


Link to post
Share on other sites
1 minute ago, guidol said:

today I did some research and I think I found something

 
Thanks! Then there seems to be some thermal_zones mismatch ... needs closer inspection. Can't tell where exactly is the problem and which fix/workaround is best. H5 boars are affected, right? Hope to check this during a week, currently deep in fixing mvebu and imx6 stuff.

 

1 minute ago, guidol said:

but lm-sensors didnt find the sensors at a working sbc


That's normal. lm-sensors are not reading values at the right place or we all have it on the wrong spot.

Share this post


Link to post
Share on other sites
2 minutes ago, Igor said:

  H5 boars are affected, right? Hope to check this during a week

I have found the problem only on H5 boards.

H2/H3 and A20 (BananaPi)/A64 (NanoPi A64) does work for me which thermal_zone0

Share this post


Link to post
Share on other sites

on my nanoPi Neo H3-CPU (not 2 or Core2 with H5) there are also 2 thermal_zones,

 

root@npi-neo(192.168.6.25):~# find /sys/devices/ -name temp
/sys/devices/virtual/thermal/thermal_zone1/temp
/sys/devices/virtual/thermal/thermal_zone0/temp
 

BUT here

thermal_zone1 does not deliver a value 

thermal_zone0  does deliver a value....

 

ARMBIAN 5.69 stable Debian GNU/Linux 9 (stretch) 4.19.13-sunxi
package bsp-kernel[5.70] u-boot[5.70] dtb[5.70] firmware[5.69] config[5.88]

Linux npi-neo 4.19.13-sunxi #5.70 SMP Fri Jan 11 21:40:58 +03 2019 armv7l GNU/Linux

 

root@npi-neo(192.168.6.25):~# more /sys/devices/virtual/thermal/thermal_zone1/temp
root@npi-neo(192.168.6.25):~# more /sys/devices/virtual/thermal/thermal_zone0/temp
46706
 

so here the zones are switched against the nanoPi Neo2 & Neo Core2

Share this post


Link to post
Share on other sites
2 minutes ago, Igor said:

So the diff is on H5 and between kernels 5.1 and 4.19 ?

yes the non-working is 5.1.0 up to 5.1.7 on H5 CPU

 

NanoPi Neo (4.19.13-sunxi) and BananaPi (4.19.38-sunxi) are on 4.19.x (H3-CPU)

Share this post


Link to post
Share on other sites

from the first view I couldnt find a problem with the thermal zones in the dtb/dts files while comparing (or should maybe thermal-sensor-cells on the H5 be activated for not defaulting to 0x0 - could be the thermal_zone?) :

sun8i-h2-plus-orangepi-zero:
============================
thermal-sensor@1c25000
compatible = "allwinner,sun8i-h3-ths";
#thermal-sensor-cells = <0x0>;
phandle = <0x27>;
ths = "/soc/thermal-sensor@1c25000";
thermal-sensors = <0x27 0x0>;

sun50i-h5-nanopi-neo2:
======================
thermal-sensor@1c25000
compatible = "allwinner,sun50i-h5-ths";
#thermal-sensor-cells = <0x1>;
phandle = <0x26>;
ths = "/soc/thermal-sensor@1c25000";
thermal-sensors = <0x26>;
                gpu-thermal {
                        polling-delay-passive = <0xfa>;
                        polling-delay = <0x3e8>;
                        thermal-sensors = <0x26 0x1>;
                };

sun50i-h5-nanopi-neo2-v1.1:
===========================
thermal-sensor@1c25000
compatible = "allwinner,sun50i-h5-ths";
#thermal-sensor-cells = <0x1>;
phandle = <0x26>;
ths = "/soc/thermal-sensor@1c25000";
thermal-sensors = <0x26>;
                gpu-thermal {
                        polling-delay-passive = <0xfa>;
                        polling-delay = <0x3e8>;
                        thermal-sensors = <0x26 0x1>;
                };
        };

 

Share this post


Link to post
Share on other sites

Hi @Igor, @guidol - in case it is helpful, I took a quick look at this and the fix is pretty straightforward.  Essentially all that needs to be done is to remove the existing "patch/kernel/sunxi-dev/ths-29-sun4i-gpadc-iio-add-h5-thermal-zone.patch" for 5.1, and to port over the 4.19 "patch/kernel/sunxi-next/ths-29-add-correct-h5-thermal-zone.patch" to 5.1 (i.e., bring into "patch/kernel/sunxi-dev/").  The problem is the currently the thermal-zone is defined in the wrong DT location, and the zone definition and tips  and cooling maps are incorrect/incomplete for the 5.1 version.

 

I did a quick test of fixing it this way and the result works:

root@nanopineo2:~# cat /proc/version
Linux version 5.1.15-sunxi64 (root@elrond) (gcc version 7.4.1 20181213 [linaro-7.4-2019.02 revision 56ec6f6b99cc167ff0c2f8e1a2eed33b1edc85d4] (Linaro GCC 7.4-2019.02)) #5.90.190705 SMP Thu Jul 4 14:05:17 UTC 2019
root@nanopineo2:~# cat /sys/class/thermal/thermal_zone0/temp
40936
root@nanopineo2:~# 

I'd fix this and submit the change myself, but unfortunately I don't have time to be thorough about testing it right now (e.g., verify on some H3 boards and other H5 boards as well), and likely won't be able to until next week...I'm happy to do this then if you don't have time to look into this.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
1 1