Fan always running after suspend

If your fan seems to be running at full throttle after suspending the computer, this could help:

  1. Create a file called 99_fan with these contents
    #!/bin/sh
    # fan spindown controller script
    # /etc/pm/sleep.d/99_fan
    #
    # https://bugzilla.redhat.com/show_bug.cgi?id=895276
    # @see https://bugzilla.redhat.com/show_bug.cgi?id=895276#c18
    
    # Save value of screen brightness
    # http://sdbillin.com/ubuntu-laptop-fan-speed-revisited/
    value=`cat /sys/class/backlight/acpi_video0/brightness`
    case "$1" in
        hibernate|suspend)
    	;;
        thaw|resume)
    	sleep 5;
    	# Turn the fans back to normal
    	for x in /sys/class/thermal/cooling_device*/cur_state; do
    	    echo 0 > $x;
    	done;
    	# Restore value of screen brightness
    	echo "$value" >/sys/class/backlight/acpi_video0/brightness;
    	;;
        *) exit $NA
    	;;
    esac    
  2. Create another file called fan_ctrl with these contents:
    #!/bin/bash
    # # To get the temperature of the cores (°C):
    # # https://lkml.org/lkml/2012/12/4/428
    # for i in /sys/devices/virtual/thermal/thermal_zone*/temp; do
    #    echo $(( $(cat "$i") / 1000 ));
    # done
    # # To check that it's right:
    # sensors
    # # To deactivate the fans upon start:
    # # https://bugzilla.redhat.com/show_bug.cgi?id=895276
    #
    for x in /sys/class/thermal/cooling_device*/cur_state; do
        sudo sh -c "echo 0 > $x";
    done;    
  3. Make the file executable (check the <path> where you saved the files, open a terminal and type cd <path>. You can also just right click on the file, go to properties and tick the box to make it executable) :
    chmod +x fan_ctrl 99_fan    
  4. Copy 99_fan to /etc/pm/sleep.d/ (requires administrator privileges):
    sudo mv 99_fan /etc/pm/sleep.d/    

You can run fan_ctrl whenever you need to turn off the fan manually. The other script (99_fan) will run automatically as superuser.

Revisions

03/08/2015 - 19:53
amrprznu