Fancontrol under Ubuntu 14.04 – resolving /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed

On my desktop computer, I am able to control the fans under Windows using software provided by the motherboard manufacturer, but it is not obvious how to do this under Ubuntu. There are various articles around on the internet, but this has been a constant problem for me so I thought I’d collect together all the info I need to provide a reference for the future.

Maybe this has arisen because my desktop PC hardware is 4 years old and newer motherboards are better integrated with modern Linux, but this is what I needed to do to solve this problem.

Caveat – if you’re not comfortable running your PC without fans for a time, don’t bother going any further. I don’t think this is particularly dangerous, but some might. When I first bought this computer, the manufacturer hadn’t attached the CPU cooler correctly and I ran for a while with the cores permanently throttling themselves at 100 degrees. The values shown below are after correcting this and replacing all the fans with high-end quiet versions (except the power supply).

Install the software

sudo apt-get install lm-sensors xsensors fancontrol

As a check to monitor fan speeds, cpu and motherboard temperatures, we first need to be able to run xsensors. Let’s detect some:

sudo sensors-detect

This identifies the kernel modules that can monitor the speed of the fans and the temperature of the cpu, motherboard etc. I answered yes to every question including the one where it does the update to the kernel configuration file. You can see the additions in /etc/modules. Here coretemp shows the cpu temperatures and w83667hg shows motherboard information such as fan speeds, temperatures and voltages.

Screenshot from 2014-10-12 19:40:43

If you run the command twice, it will put the drivers into /etc/modules twice.

To use the kernel modules, I ran:

sudo service kmod start

Here are some links to more information:

https://wiki.archlinux.org/index.php/lm_sensors

https://help.ubuntu.com/community/SensorInstallHowto

Then you can run sensors on the command line:

Screenshot from 2014-10-12 20:00:36

or xsensors to get this in a dynamically updating window:

Screenshot from 2014-10-12 20:00:59

Enable Fan Setup Configuration

This is where we get the first error that may not be obvious how to fix. What we are trying to do is to automatically have the fan speeds controlled by a sensor temperature. This can be set up using pwmconfig. When I first ran it, I got the error:

/usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed

This can be fixed by relaxing an acpi check in the kernel (hmm), see https://hydra.geht.net/tino/howto/linux/fixes/w83627hf/ amongst others for more details. The way I fixed this is to edit /etc/default/grub to add acpi_enforce_resources=lax to the GRUB_CMDLINE_LINUX_DEFAULT giving:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_enforce_resources=lax"

Then need to update the boot configuration:

sudo update-grub

and reboot.

Fan Setup Configuration

Then I could run pwmconfig:

Screenshot from 2014-10-12 20:30:12I think it’s worth taking a moment to understand the concepts that are being shown here. These all refer to sub-directories of /sys/class/hwmon. In standard Linux fashion, these directories contain files that can be read or written to control the physical devices we are interested in:

  • Devices – these are the bits of hardware that can have monitoring capabilities – as shown earlier, coretemp = cpu, w83667hg = motherboard and radeon = video card.
  • PWM controls – these are the devices that can control fan speeds using pwm.Β  Pwmconfig will cycle through each one and see if any of the fans has had their speed changed. For those that don’t know, pulse width modulation (PWM) is a way to use a digital output to control an analogue device. 255 represents fully on (power rail value e.g. 5v), 0 represents ground (e.g 0v). For an intermediary value, it represents the percentage of time that the high value will be on the output – so 150 would mean (150/255) * 100 = 59% of the time. The speed of update of the pulse is much faster than the analogue device can handle so it treats it like a lower voltage – in this example it would effectively be 5v * 59%Β  = 2.9v.
  • Fan sensors – these devices can be read to give the current fan speed.

For example, on my computer I can read all the fan speeds and then set most of them using one of the pwm controls (must be root to do the setting):

Screenshot from 2014-10-12 20:58:05These values should also be shown dynamically in xsensors if you have it running.

Using this ability, you can find out which fans your pwm devices are able to control. In my situation, I can see that only pwm2 controls any fans, and they are fans 1, 4 and 5. Fan 2 has no ability to be controlled. Pwm1 and pwm3 do nothing. I have 3 case fans and 1 cpu fan, maybe if I figure out which fan is not able to be controlled, and then connect it to the unused fan3 control, I could control that with pwm2 as well?

Pwmconfig does this analysis in a more rigorous way, but I found it easier to do this myself to really understand what was going on. This also allows you to figure out good values to use. So, back to pwmconfig. Breaking the suspense, it recomments using gnuplot to plot correlations between pwm control values and fan speeds – this didn’t work for me. Instead I had to fall back on the terminal output.

While this is happening, it’s also important to listen to how loud the fans are. In my case, the reason for doing this configuration is to reduce the noise made by the fans. I don’t need to actually stop them, I just need to set the minimum speed to a value where the fans make as least noise as possible, while providing the maximum cooling at that noise level.

When pwmconfig asks if you want to do a detailed correlation, let it. Here is a section of the output for me:

Screenshot from 2014-10-12 21:27:49This manipulates each pwm control and then checks through the fan speeds to see if any have been affected. Here, pwm1 and pwm3 are recognised as having no function and pwm2 is identified as controlling fans 1, 4 and 5. Using the detailed correlation and acoustic monitoring, I found that as soon as the pwm value descends from 255, the fans slow and the volume starts to decrease. When it reaches 150, I can no longer hear any change in volume as the uncontrollable fan 2 becomes dominant. Possibly if it wasn’t there, I could go further.

Then we can proceed within the pwmconfig script to setting up a fancontrol config file. On the next menu, I selected 1) hwmon1/device/pwm2 to configure. As the settings will be temperature controlled, we need to choose a particular temperature sensor to be the driver. We are presented with a list of all sensors on each device:

Screenshot from 2014-10-12 21:56:19I get the highest temperature readings from the cpu (core 2), so I would like that to determine how I set my fans. This corresponds to item 3 in the menu. Here is how I set up the values:

Screenshot from 2014-10-12 22:10:53And then choose 4 to save the values.

Salvaging fancontrol

This is where things should be fine – running fancontrol now gives me errors:

Error: file hwmon1/device/pwm2 doesn't exist
Error: file hwmon1/device/fan4_input+hwmon1/device/fan1_input doesn't exist

Well, these do exist and they are correct, so this may be a configuration syntax issue.

sudo cp /etc/fancontrol /etc/fancontrol_orig
sudo vi /etc/fancontrol

This line looks a bit suspicious:

FCFANS= hwmon1/device/pwm2=hwmon1/device/fan5_input+hwmon1/device/fan4_input+hwmon1/device/fan1_input

It contains both of the errors reported, so let’s change it to:

FCFANS= hwmon1/device/pwm2=hwmon1/device/fan5_input

I don’t think it really matters that 1 or 3 fans is controlled by the same parameter, the action of the system to increase pwm2 when the temperature exceeds 50 degrees Celsius should be the same. Trying fancontrol again and it works!

Screenshot from 2014-10-12 22:25:20
Now all we need to do is make fancontrol get started when the system starts. Checking /etc/fancontrol, there is already a script for this, so should all be ok. Test by rebooting and in the middle of the ubuntu initialisation screen, the fans go quiet!

Let me know if you have any luck with this or if I’ve missed something. Here’s to a quieter future for all.

Update for Ubuntu 14.10

I upgraded to 14.10 today and this stopped working. When I typed fancontrol, I got:

Error: file hwmon1/device/pwm2 doesn't exist.

The solution that fixed this for me was to:

sudo mv /etc/fancontrol /etc/fancontrol_v2

Then repeat the steps above from pwmconfig onwards to generate a new /etc/fancontrol. Test that it’s ok using:

sudo fancontrol

Rebooting confirmed this was working during startup

Advertisements
Leave a comment

13 Comments

  1. Esteban

     /  February 20, 2015

    This looks like this would really help me out. Im not to sure how to work out this step

    This can be fixed by relaxing an acpi check in the kernel (hmm), see https://hydra.geht.net/tino/howto/linux/fixes/w83627hf/ amongst others for more details. The way I fixed this is to edit /etc/default/grub to add acpi_enforce_resources=lax to the GRUB_CMDLINE_LINUX_DEFAULT giving:

    how do you relax an acpi check in the kernal?

    Reply
    • My windows motherboard software is asus epu-6 engine. You will need to check to see what came with your motherboard. First, find out what you have got.
      For the kernel check, investigate grub and you will find it is what starts Linux. It sets the kernel options in the manner I describe in the next sentence, so you just need to do that.

      Reply
  2. Worked great. Only change was to fix fancontrol. Originally it had this line

    FCFANS= hwmon0/device/pwm1=

    Which I changed to this manually

    FCFANS= hwmon0/device/pwm1=hwmon0/device/fan1_input

    Reply
  3. I really have so many expectations from this post. Great effort man! But I am facing some problem. I am stuck at Fan Configuration Setup. When I run “sudo pwmconfig” I get this error “/usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed”. Please help I am unable to conquer my CPU fan.

    Reply
    • You need to follow the instructions in the Enable Fan Setup Configuration section above. Read the info at the link too. Of course you must have hardware that supports this. Your BIOS and motherboard documentation can help you there.

      Reply
  4. sp1etz

     /  October 23, 2015

    Thank you! That helped alot. really good job! πŸ™‚ πŸ™‚ πŸ™‚

    Reply
  5. Thanks.
    However this why Lunux/Ubuntu are not “there”.

    Reply
  6. Anjela

     /  January 26, 2016

    sudo mv /etc/fancontrol /etc/fancontrol_v2 doesn’t work for me

    Reply
  1. /usr/sbin/pwmconfig: There are no pwm-capable sensor modules installed – Internet and Tecnnology Answers for Geeks
  2. Fan noise in LG U460 in Ubuntu 16.04 - ubuntutextbook
  3. Asus K75VM laptop fans not detected, Ubuntu 16.04 - Ubuntutextbook
  4. Macbook Pro8,3 – 17″ 2011 with Lubuntu and Windows 7 – bvrulez

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: