Ubuntu – Cannot configure Fan Speed with pwmconfig


I have a ASUS TP301UJ laptop with dual-boot and my fan is quite loud all the time. I am trying to configure my fan speed in Ubuntu (I did it easily in Windows 10), but I am having problems.

Here is what I did:

  1. I installed lm-sensors, psensor and fancontrol. psensor worked well, and read the fan speed and all temperatures.

  2. Ran sudo sensors-detect which only said that I needed to add coretemp to /etc/modules. coretemp was already in modules so I did not do anything.

  3. Rebooted. Ran sudo pwmconfig and it output:

    Found the following devices:
    hwmon0 is acpitz
    hwmon1 is coretemp
    hwmon2 is asus

    Found the following PWM controls:
    hwmon2/pwm1 current value: 0

    hwmon2/pwm1 is currently setup for automatic speed control.
    In general, automatic mode is preferred over manual mode, as it is more efficient and it reacts faster. Are you sure that you want to setup this output for manual control? (n)

  4. Entered "y" and the output was:

    Giving the fans some time to reach full speed…

    Found the following fan sensors:
    hwmon2/fan1_input current speed: 0 … skipping!
    There are no working fan sensors, all readings are 0.

    Make sure you have a 3-wire fan connected.
    You may also need to increase the fan divisors.
    See doc/fan-divisors for more information.

So my fan enters "manual mode" and starts running at full speed but pwmconfig exits, leaving my fan running at full speed. Changing the number in /sys/class/hwmon/hwmon2/pwm1_enable from 1 back to 2, makes it automatic again.

Here is my problem (I think): When my fan is in "manual mode", sensors shows -1 as its speed. It is not detected! But in automatic mode, there is no problem at all. This makes it impossible for me to configure the fan with pwmconfig.

I have already tried adding acpi_enforce_resources=lax to the variable GRUB_CMDLINE_LINUX_DEFAULT in the grub file. The result is the same.

What should I do?

Best Answer

Start out by man fancontrol to get a feel for what variables can be used in /etc/fancontrol. You will need the following when building the config: INTERVAL, FCTEMPS, FCFANS, MINTEMP, MAXTEMP, MINSTART, MINSTOP.

# Checks the temperature every 10 seconds.
# Maps a fan to a temp sensor, each separated by a space 
FCTEMPS=fanpath=temppath fanpath2=temppath2
# Maps a fan to the fan speed sensor
FCFANS=fanpath=fanspeedpath fanpath2=fanspeedpath2
# The temperature below which the fan gets switched to minimum speed.
MINTEMP=fanpath=degreesC fanpath2=degreesC2
# The temperature over which the fan gets switched to maximum speed.
MAXTEMP=fanpath=degreesC fanpath2=degreesC2
# Sets the minimum speed at which the fan begins spinning.
MINSTART=fanpath=minspeed fanpath2=minspeed2
#The minimum speed at which the fan still spins.
MINSTOP=fanpath=minspeed fanpath2=minspeed2

Actual Sample:

FCTEMPS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=/sys/devices/platform/coretemp.0/hwmon/hwmon[[:print:]]*/temp3_input
FCFANS=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan5_input /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/fan4_input /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=
MINTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=55 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=50 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=55
MAXTEMP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=60 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=60 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=60
MINSTART=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=70 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=70 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=70
MINSTOP=/sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm5=90 /sys/devices/platform/nct6775.656/hwmon/hwmon[[:print:]]*/pwm4=90 /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/hwmon/hwmon[[:print:]]*/pwm1=90

The [[:print:]] represent the hwmon number. You can use the actual number or the [[:print:]], sometimes the number changes between boots and the [[:print:]] allows it to find the correct hwmon number.

The issue will be FCFANS, whether fan1_input has valid data, and if not, whether fancontrol will continue to work without that.

Alternatively, you could attempt to write your own script that would set the value of hwmon2/pwm1, it ranges between 0 and 255.