Imac with Ubuntu (Lubuntu 20.04) - Controlling fan speed
The situation
I switched an old Imac (2008) to Lubuntu. While it runs smoothly for all I need to do, 20 minutes after starting the CPU fan starts to get super loud. Here is a screenshot of psensor: psensor screenshot psensor screenshot
Basically, 2 sensors, TD0D and temp1 see an increase in temperature until reaching 105°C, which triggers the increase of the CPU fan speed. This fan gradually accelerate until its max, 3600 RPM, which makes the imac very loud. This do lower the temp of these 2 sensors, until aournd 80°C, but this is not cool enough to reduce the fan speed.
This is annoying because I think with a fix speed set to 2000 RPM for example, the temp would stabilise at an acceptable temperature, hopefully below 90°C, while the noise would still be acceptable.
What I tried so far
I tried to follow the steps described here: How to control fan speed?, so basically set up lm-sensors, then set up fancontrol with the help of pwmconfig But pwmconfig answers: There are no pwm-capable sensor modules installed Even after adding the module applesmc to /etc/modules and rebooting, no chance.
I also tried to install mbpfan: https://github.com/linux-on-mac/mbpfan But it is meant for macbooks and not for imacs, with the result that only one sensor seems to be taken into account, then all fan speed are raised simultaneously, which is not helping in my case (see https://github.com/linux-on-mac/mbpfan/issues/211)
What I think could work but not sure how
pwmconfig is "just" a helper to create the fancontrol settings file. So I could simply make this settings file myself and set up a min speed of 200 RPM for the CPU fan. But I am not sure this can work, because maybe fancontrol can only control PWM fans and somehow imac fans are not PWM. Also, if it can work, I am unsure what should be the path of each fan to put in that file and whre I could find an example of settings file.
So: can fancontrol work? if not, do you have any other ideas?
Actually, I realise the problem seem to come from the GPU, since temp1 seems to be in the Radeon PCI section. My imac has a Radeon RV630 Graphic Card. Could it be that there is a better driver somewhere that would lead to it heating less? This is happening while browsing internet or even not doing anything, so it's not linked to complex graphics calculations...
here is the output of sensors if that helps
applesmc-isa-0300
Adapter: ISA adapter
ODD : 698 RPM (min = 700 RPM, max = 4800 RPM)
HDD : 1229 RPM (min = 1200 RPM, max = 5900 RPM)
CPU : 3602 RPM (min = 1200 RPM, max = 3600 RPM)
TA0P: +27.8°C
TC0D: +50.5°C
TC0H: +49.8°C
TC0P: +50.0°C
TG0D: +78.8°C
TG0H: +66.2°C
TG0P: +71.0°C
TH0P: +57.8°C
TL0P: +58.0°C
TO0P: +49.8°C
ERROR: Can't get value of subfeature temp11_input: I/O error
TW0P: N/A
Tm0P: +53.2°C
Tp0P: +82.8°C
radeon-pci-0100
Adapter: PCI adapter
temp1: +80.0°C
coretemp-isa-0000
Adapter: ISA adapter
Core 0: +49.0°C (high = +105.0°C, crit = +105.0°C)
Core 1: +59.0°C (high = +105.0°C, crit = +105.0°C)
Thanks a lot for the help!
OK, I advanced a bit on my side, replying here in case it is one day helpful for someone else.
I found a way to control all 3 fans of my imac (cpu, HD, Optical Drive): macfanctld (see http://manpages.ubuntu.com/manpages/bionic/man1/macfanctld.1.html) I recompiled it with the change proposed here https://github.com/MikaelStrom/macfanctld/pull/11 because it was otherwise not controling the CPU fan.
So I can now control my 3 fans, set a min speed, a floor and a ceiling, which is a success!
But even with a high initial speed, I still get a burst some times after booting when the Tp0P sensor reaches 84 degrees. The CPU fan then increase its speed until the temp reduces, but there is a long delay for it to be effective, so usually 10 really loud minutes. I don't think I can change this value anywhere, which is sad because I think it really would not go much higher than this.
So I guess I will rather work on the cause: It is the Power Supply Unit (PSU) that is overheating, not the GPU as I previously stated. I am thinking about making holes in the case to reduce the heat passively, or to somehow install a new fan directly on the PSU. Doing a deep cleaning of the case and the PSU already won a few degrees.
First and foremost, I do not run Ubuntu, I run MX Linux, but with MX Linux being Debian compliant and Ubuntu have a similar Debian type base, the same tools should work just fine.
Having just swapped out my sons failing 2006 iMac for a 2010 model, I found a previous owner had removed the HDD sensor when they installed a SSD, so the internal fans were all running at full speed, upwards of 6000rpm and they were loud, very very loud.
I simply installed mbpfan and within a few seconds, without having to do anything else, all fans went down to roughly 1200 rpm and basically stayed there. After a day of use and measuring heat ranges with sensor viewer, I thought the machine was running a little too warn for my liking so I followed some simple instructions to obtain the info I needed. The 2 commands below generated the min and max fan speed results, however, keep in mind mbpfan only controls the CPU fan speed.
cat /sys/devices/platform/applesmc.768/fan*_min
cat /sys/devices/platform/applesmc.768/fan*_max
Digging deeper I found the values for this machine were
ODD min 1000 max 4350
CPU min 1100 max 6300
HDD min 1200 max 4000
The next command identifies the max temp before the thermal max for your CPU
cat /sys/devices/platform/coretemp.*/hwmon/hwmon*/temp*_max
Whatever the result, divide by 1000 to get the temperature in degrees celsius. This machine is 89000 ÷ 1000 = 89°c
Armed with this information, I only had to edit 3 lines in /etc/mbpfan to have the system to start increasing fan speeds a little sooner as the heat increases. I changed the values from
low_temp = 55
high_temp = 65
max_temp = 88
to
low_temp = 50
high_temp = 60
max_temp = 85
and the machine runs a few degrees cooler now. It gets a little noisier as it heats up now, but we can't hear it above our fish tanks water trinlking and bubbling, so it's quite acceptable.
Simple and effective.