How to make Apple machines run cooler on Linux?

35 respuestas [Último envío]
GrevenGull
Desconectado/a
se unió: 12/18/2017

The two Apple machines I am in control of suffer from hot temperatures using anything other than MacOS. I've also heard this is a common issue with Apple machines.

There was someone here in this forum that mentioned that this may have something to with how the Linux kernel are not as efficient as the Apple kernel in regards to the usage of the CPU's different states.

So I am wondering... If I want to make Apple machines run cooler on Linux. If I want to help the Linux Libre project, but specifically in regards to making it more Apple machine-friendly, where do I start?

I am sure many people have wanted this before me, but I would not forgive myself if I at least didn't try. There are so many old Apple machines laying around, and they can be quite nice casual personal computers if only it was able to run a little cooler.

Anyway, I am getting off track here, what I am asking this forum about is guidance to how/where/what I should do.

I have limited/none coding/tech skills, but I have enormous willpower. I am more than willing to use time and to learn along the way.

I understand that there are drivers needed to get the most out of different components. Are the CPU any different?

GrevenGull
Desconectado/a
se unió: 12/18/2017

I have no idea where to start, so I'm just shooting questions:

When making drivers for components (and in this situation the CPU), are there ways to make the driver work with many different CPUs or is it necessary to make one driver for each different CPU.

loldier
Desconectado/a
se unió: 02/17/2016

Have you installed sensors?

sudo apt install lm-sensors

I have a 2015 Macbook Air with Mint 18.3 installed. It runs pretty cool.

There's something here. Perhaps you could try turning turbo off (if any).

http://www.hastymail.org/macbook_stuff/pstate_driver_example.txt

2018-04-06-153823_1044x604_scrot.png
GrevenGull
Desconectado/a
se unió: 12/18/2017

Thank you for this!

In the second link you posted there are three commands, right? The first one disabling the turbo, but what does the next two?

GrevenGull
Desconectado/a
se unió: 12/18/2017

PS. Quite strange that your machine seems to be that much cooler.

loldier
Desconectado/a
se unió: 02/17/2016

Behind the first link titled "Something here" there's an explanation at the end. Scroll down and read the lines that explain the use of the scripts and config files.

That particular line says "Example of tweaking the Intel CPU scaling Pstate driver".

I took a look and my Macbook Air had "0" -- that is 'on'. The path is '/sys/devices/system/cpu/intel_pstate/' followed by files that you can edit.

GrevenGull
Desconectado/a
se unió: 12/18/2017

I believe you misunderstood my question.

But anyway, it seems that I am missing the "intel_pstate" folder.

loldier
Desconectado/a
se unió: 02/17/2016

The first one disabling the turbo, but what does the next two?

It's written there in the remarks after #.
echo '1' > '/sys/devices/system/cpu/intel_pstate/no_turbo'; # disable turbo CPU speeds
echo '35' > '/sys/devices/system/cpu/intel_pstate/min_perf_pct'; # set minimum CPU speed to 35%
echo '100' > '/sys/devices/system/cpu/intel_pstate/max_perf_pct'; # set maximum CPU speed to 100%

GrevenGull
Desconectado/a
se unió: 12/18/2017

What is CPU speed? What is the default minimum and maximum CPU speed?

loldier
Desconectado/a
se unió: 02/17/2016

You say you don't find the path or it doesn't exist. Here's my HP, it's there if it's Intel.

CPU speed must be the bus (external) speed factor. CPUs are clocked multiplying the base (internal) speed 2x and so on. But I'm not sure here. The effect will, anyway, be scale down and up.

https://en.wikipedia.org/wiki/CPU_multiplier

##EDIT##

Forget about CPU multiplying, it's explained here (called 'scaling'):

https://www.kernel.org/doc/html/v4.12/admin-guide/pm/cpufreq.html

https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html

intel_pstate.png
GrevenGull
Desconectado/a
se unió: 12/18/2017

It seems as though I am missing the "intel_pstate" folder, but I have /sys/devices/system/cpu/cpufreq

and inside this "cpufreq" folder the seems be some scripts for doing something similar to the CPU speed minimum and maximum.

Inside the "cpufreq" folder there are three folders "ondemand", "policy0" and "policy1". I suspect that the policy0 and policy1 folders maybe controls the two cores in the CPU or something like that, because the two folders seems to hold exactly the same things.

Anyway if I enter the policy0 folder there's another folder called "stats" and a bunch of scripts. Among the scripts there are one called "scaling_max_freq" and one called "scaling_min_freq". If I open them I am presented a number which seems to maybe represent hertz. So I may be able to manually set the maximum and minimum hertz there? :)

loldier
Desconectado/a
se unió: 02/17/2016

I wish somebody in the know would step in. I'm afraid I can't tell.

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

Execute this command to use the "powersave" governor for all your cores:
$ nprocessors=$(getconf _NPROCESSORS_ONLN); nprocessors=$(expr $nprocessors - 1); for i in $(seq 0 $nprocessors); do sudo cpufreq-set -c $i -g powersave; done
That does not mean your cores will not be able to switch to the highest frequencies. It just mean the kernel will wait to be sure that the process needs that much resource before switching. However, if you want to to fix a maximal frequency, the -u option of 'cpufreq-set' does that.

GrevenGull
Desconectado/a
se unió: 12/18/2017

Hi, thank you for stopping by MB! :)

> Execute this command to use the "powersave" governor for all your cores:

What exactly does that command do, and is there a similar thing for the GPU? I searched around to find out what all the sensors mean, and it seems my GPU is also getting quite hot.

> However, if you want to to fix a maximal frequency, the -u option of 'cpufreq-set' does that.

What is the "cpufreq-set"? :)

GrevenGull
Desconectado/a
se unió: 12/18/2017

btw I tried to just copy what wrote:

nprocessors=$(getconf _NPROCESSORS_ONLN); nprocessors=$(expr $nprocessors - 1); for i in $(seq 0 $nprocessors); do sudo cpufreq-set -c $i -g powersave; done

and paste it in the terminal and I got:

"sudo: cpufreq-set: command not found
sudo: cpufreq-set: command not found"

loldier
Desconectado/a
se unió: 02/17/2016

Most likely it's not installed.

sudo apt install cpufrequtils

2018-04-07-183626_484x316_scrot.png
GrevenGull
Desconectado/a
se unió: 12/18/2017

Cool thanks, I got no errors now, let's wait and observe the temps :)

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010
GrevenGull
Desconectado/a
se unió: 12/18/2017

Thank you for this! :)

GrevenGull
Desconectado/a
se unió: 12/18/2017

Do you happen to know an easy way to set the cpu frequency mode to "powersave" at startup? :)

GrevenGull
Desconectado/a
se unió: 12/18/2017

I think I got it with just following your guidance from another post and switching out some parts of the scripts: https://trisquel.info/en/forum/temperatures-inside-pc-high?page=1#comment-125753

But anyway, I'm trying to make a script for mbpfan as well.

Usually when I am in the terminal and type "$ sudo mbpfan" the program kicks in immediately. But I am not able to make script for it.

Magic Banana

I am a member!

I am a translator!

Desconectado/a
se unió: 07/24/2010

With Trisquel 7 (but probably also with Trisquel 8), write the command line I gave you, without 'sudo', in /etc/rc.local, before the exit statement.

rmusial
Desconectado/a
se unió: 10/28/2015

I found that my MacBook Pro would get pretty hot while running anything Linux kernel based. Some distros ran hotter than others, and it seemed to be fan speed. I could run 'stress' and I would watch my fan RPMs never get much above the idle speed of 2000 RPM. I found a project called mbpfan a few years ago, and it works great.

It is GPLv3, and full disclosure I help maintain it. One of the tasks I did got Trisquel on the "Verified GNU/Linux Distributions" list for the project.

https://github.com/dgraziotin/mbpfan is the upstream.

GrevenGull
Desconectado/a
se unió: 12/18/2017

Cool, I think I managed to install it. But being a daemon, does that mean that there is no CLI or GUI or anything, I just install it, and then it is running in background?

Right now I have the fans set manually, do I need to change them back to auto for the mbpfan to work?

rmusial
Desconectado/a
se unió: 10/28/2015

Correct, in daemon mode, just install it and set it to run at start up. If you want to run it in the foreground you can manually do mbpfan -f for verbosity you can do mbpfan -v, or look in /var/log/messages to see its output there.

There are a few different ways to set your fans manually, but this should override it.

GrevenGull
Desconectado/a
se unió: 12/18/2017

How do I set it to run at startup? :)

GrevenGull
Desconectado/a
se unió: 12/18/2017

I want to install mbpfan on another device, but forgotten how the installation process is.

Are you able to tell me how?

GrevenGull
Desconectado/a
se unió: 12/18/2017

nvm, I didn't realize that "build-essentials" was a package I needed to install.

I should probably get some sleep...

GrevenGull
Desconectado/a
se unió: 12/18/2017

Interesting thing though:

I have a panel at the top dedicated to hardware sensors, and the "TGOD" and the "TpOP" are the two that is significantly hotter than the rest. Usually 6-7 degrees celsius over the next hottest thing.

After some internet searching it turns out that those two are the GPU and the PSU. Mind you the CPU is also almost always very hot, when I am not loading the computer (just typing this comment for example and doing simple stuff) it seems that the PSU gets hottest, than the GPU, and then the CPU.

But the three fans I have are the ODD, the HDD and the CPU. No cooling for either the GPU nor the PSU.

GrevenGull
Desconectado/a
se unió: 12/18/2017

Just for logging purposes I will now post a screenshot showing my hardware sensor panel at the top of the desktop.

I have now been using the cpupower frequency-set governor "powersave" for some time, and the mbpfan program.

The sensors are from left to right:

temp1, ODD, HDD, CPU, TA0P, TC0D, TC0H, TC0P, TG0D, TG0H, TG0P, TH0P, TL0P, TO0P, TW0P, TW0P, Tm0P, Tp0P, Core 0, Core 1

Screenshot at 2018-04-07 23:07:25.png
GrevenGull
Desconectado/a
se unió: 12/18/2017

output of "$ sensors" command after some time running powersave governor and mbpfan. Things are looking a little bit better.

Screenshot at 2018-04-07 23:11:54.png Screenshot at 2018-04-07 23:12:03.png
rmusial
Desconectado/a
se unió: 10/28/2015

Great! I don't check these forums all the time, so if you have questions or bug reports, just open them on the git repo. I, and the other maintainers, are active there.

strypey
Desconectado/a
se unió: 05/14/2015

Apologies if I ask some off-topic questions GrevenGull, but which distro(s) do you run on your Apple devices, which model devices are they, and did you have to do anything unusual to get GNU-Linux installed and working on them? I just started a thread focused on getting Trisquel 8 to install reliably on Macs. Any knowledge you could share there would be most appreciated:
https://trisquel.info/en/forum/getting-trisquel-8-working-macs

GrevenGull
Desconectado/a
se unió: 12/18/2017
GrevenGull
Desconectado/a
se unió: 12/18/2017

I saw an older post in this forum about Libreboot on old MacBooks.

One person there had modified their MacBook to have an air-intake at the bottom that resulted in almost 20 degrees lower temps.

Are there anyone else in this forum that has done modifications to MacBooks in the hopes of getting their temps down?

I can't remember where or when, but someone said that it has to do with how the Linux Kernel does not quite handle the different states of the apple CPUs as well as Apple's own kernels. If that's the case I am wondering: perhaps on could replace the CPU?

GrevenGull
Desconectado/a
se unió: 12/18/2017

I would just like to point at that I tested out vita_cell's modification tips:

https://trisquel.info/en/forum/librebooted-macbook-21#comment-80134

I just removed the whole backplate (MacBookPro 9,1) and put the computer on top of four glasses so that the computer was totally "open" underneath and free air entrance and... it was amazing lol :P

Definitely check out that solution if you have a macbook and the temps annoy you!

Thank you vita_cell!

Now I think I'll be looking for some dust filter in some way, or at least some kind of solution to make it more permanent.

I should have included a picture of the laptop standing on top of four glasses with no backplate, but I have no free camera at the moment ;)