7

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?

  • can you not change the fan speeds in the motherboard BIOS settings? this would be greatly preferred to software IMO – Nmath Nov 11 '19 at 00:37
  • @Nmath I do not think I can change the fan speeds in my BIOS. At least, as it is, there is no option for such. – João Bravo Nov 11 '19 at 03:25
  • Just to be clear, hwmon2/pwm1 is controlling your fan but pwm-config cannot detect the fan speed? What else is listed under /sys/class/hwmon/hwmon2/? – rtaft Nov 11 '19 at 14:07
  • @Nmath Yes, I have BIOS v303 since 04/2019 – João Bravo Nov 12 '19 at 12:48
  • @JoãoBravo if you can control the fan but not detect its speed, I believe you can configure fancontrol manually. – rtaft Nov 13 '19 at 13:33
  • @rtaft Yes, hwmon2/pwm1 controls my fan but the output, even in psensor, is -1 if the control of the fan is set to manual.

    Under /sys/class/hwmon/hwmon2/, there is:

    power/, fan1_input, name, pwm1_enable, temp1_input, device@, fan1_label, pwm1, subsystem@, uevent

    – João Bravo Nov 15 '19 at 01:24
  • @rtaft Oh, do you know how to configure fancontrol manually? – João Bravo Nov 15 '19 at 01:29

2 Answers2

4

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.
INTERVAL=10
# 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:

INTERVAL=10
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.

rtaft
  • 1,825
  • Thanks, that worked for automating the fan! My CPU temperature sensor jumps all over the place though... With INTERVAL=3, the readings jump from 55ºC to 65ºC to 75ºC, so it kind of sucks hearing the fan change every 3 seconds... Do you think these readings may be accurate at all? Should I just change INTERVAL to 10 or 15 or can I actually fix the readings? – João Bravo Nov 16 '19 at 19:01
  • I do not really understand what is MINSTART and MINSTOP. How are they really used? – João Bravo Nov 16 '19 at 21:13
  • 1
    @JoãoBravo Think static friction, the minimum start power is the power needed to get the fan moving from a dead stop. The minimum stop power is how low does the power need to go before the fan stops (kinetic friction). – rtaft Nov 17 '19 at 12:46
  • 1
    @JoãoBravo The jumpy temperatures are normal, because the CPU can generate heat pretty quickly and the thermometer is in each core, faster than the fan at low speeds can transfer the heat out. Even with liquid cooling, my cooler temp is at 30C but I can have my CPU over 60C by maxing the CPU and it kicks the fans on which doesn't affect the CPU temp. The fans don't really help much until the liquid gets warmer. – rtaft Nov 17 '19 at 12:57
  • 1
    Yup, that makes sense. So, should I test the fan manually and input the values I get, or does it make sense to set the values to my liking (taking the test into account)? For example, my fan starts spinning at 50 but I can barely hear it, it’s really slow and won’t do much. Does it make sense to set it to, say, 90 so the cooling is faster? – João Bravo Nov 17 '19 at 15:16
  • 2
    The pwmconfig basically does that check for you, so unless you can see the fan spinning, it's hard to know what to use for exact values. Just monitor your temps at different speeds and make sure it can keep the temp reasonable. You can have the fun running slightly faster for its min value, that might help reduce the number of times it increases to a higher speed. – rtaft Nov 18 '19 at 22:56
  • That's what I thought. Thank you for the help! – João Bravo Nov 19 '19 at 01:52
1

The nct6775 has the possibility to control the fan in hardware. It allows for setting a certain temp source as input and then control fans in steps based on the temperature. So no script needed other than to load the settings of the chip. The fancontrol tool from above has the disadvantage that when it is stuck, has an error or bug it might not function.

In the /sys/devices/platform/nct6775.656/hwmon/hwmonX directory.

X below is the FAN. Some settings might already be set by the bios.

pwmX_mode sets the fan mode. 0 is PWM, 1 Voltage controlled. You can set it. But reading always gives 1.

pwmX_temp_sel is which temp sensor feeds this fan.

echo 5 > to the pwmX_enable sets the fan in smart mode. This means the hardware (the nct6775 chip) is controlling the fan.

The pwmX_auto_point1_pwm to pwmX_auto_point5_pwm set the fan speed steps. Values from 0 to 255. My fans start spinning around 85. So I have 85 90 100 140 255 as steps.

The corresponding temps are set in the pwmX_auto_point(1-5)_temp. Values in celcius.

  • You could just go to the bios to configure it, much easier than setting these values manually from the command line. These would often reset on me back to the default config, which is why I use fancontrol with pwm. – rtaft Aug 17 '20 at 14:07
  • The ASUS BIOS has stupidly high minimum PWM values so I would love to set the curves in BIOS but cut down the PWM values lower than the BIOS allows for low temps. I guess ASUS thinking was to make sure that fans keep spinning at all times but they stupidly choose to control minimum PWM duty cycle minimum instead of minimum RPM. I want my system practically silent when its cool. – Mikko Rantalainen May 27 '23 at 14:45