fancontrol Not Working after Resume from Hibernate

I setup fancontrol and lm-sensors on our new mini file server yesterday. I did it by following this fanspeed how-to article. However when I got up this morning after the server running Ubuntu had automatically woken from hibernation the fan was spinning at max RPM. I suspect it had reverted to manual fan control. This was fixed easily enough with:

sudo service fancontrol restart

But I don’t want to be doing that every morning. A bit of Googling suggested that this was a bug of unknown origins. There doesn’t seem to be any real fix so I decided on a work-around. This meant simply running a script when the file server resumed from hibernation. To do this I just created the following script in /etc/pm/sleep.d/20_fancontrol

#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin

case "${1}" in
    resume|thaw)
      service fancontrol restart
      ;;
esac

Then I made the script executable with

sudo chmod +x /etc/pm/sleep.d/20_fancontrol

I quickly tested this with:

sudo rtcwake -u -m disk -t 09:00

And when the computer re-started the fan was spinning at the correct speed.

This entry was posted in linux on by .

About markn

Mark is the owner and founder of Timesheets MTS Software, an mISV that develops and markets employee timesheet and time clock software. He's also a mechanical engineer, father of four, and a lifelong lover of gadgets.