My *nix world

Fan runs at full speed after resume

OK, let's suppose you have a PC (laptop/desktop) which runs the GNU Linux. Normally when you just step out to drink a coffee or smth. you suspend it in memory then you wake it up via resume.

What to do if the fan runs at full speed after resume from suspend?

Well, remember, you are on Linux. It means you are the boss! You control it and not vice-versa (see Windows).

First make sure you check the following:

  • the lm-sensors package is installed (lm_sensors is a free open source software-tool for Linux that provides tools and drivers for monitoring temperatures, voltage, humidity and fans).
  • the pm-utils package is installed (pm-utils is a suspend and powerstate setting framework).

We assume that these two are installed/configured properly. Check the sensors temperature by running the sensors command:


As you can see the third sensor temperature indicates 100 degrees which I'm sure it's just hogwash. These sensors have an interface in /sys/class/thermal/cooling_deviceX where X is a number. I don't know which sensor binds what but I will detect it by trial and error. We will run the following command for X between 0 and the last cooling_device shown in the above folder:


At some point the fan stops (you will notice because the average dB in the room will lower). That is your cooling device! Now let's program the system to run this statement each time the system resumes from the suspend. With other words we will create create a hook on the pm-utils resume event which will reset the cooler. All the built-in hooks are already present in /usr/lib/pm-utils/sleep.d/ folder. We will add our new hook (which is nothing but a bash/sh script) to that folder. Just create a file called /usr/lib/pm-utils/sleep.d/60fan with the following content:


Make sure it has eXecute bit on so after creating that file run the following command:


Put your laptop on suspend then resume it. The fan should run at its lowest speed. If not then just replicate the following line (within our 60fan file):


for all X between 0 and the latest cooling device.

That's all folks!

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

 
The following two tabs change content below.
Fan runs at full speed after resume

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Fan runs at full speed after resume

Latest posts by Eugen Mihailescu (see all)

Tagged on: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: