Ubuntu – High CPU temp on boot + Fan noise on Ubuntu/Thinkpad T490

cpufanoverheatingtemperaturethinkpad

I've recently installed Ubuntu 20.04 on my Thinkpad T490 and i noticed something strage and different on CPU temperatures on Ubuntu compared to Windows.

I don't know why, but on boot the fan spins very fast (probably due to high CPU temp), and this never happened on Windows 10.

Somebody who knows why? I also tried "thinkfan", but I think it's better to control the fan using the BIOS default configuration (wich I think is the one the Lenovo Vantage app uses).

Best Answer

Ubuntu boots with the CPU frequency scaling governor set to performance. By default, it will switch to something less power hungry after a few seconds, depending on your processor (about 10 for mine). It used to be 1 minute, but this seems to have changed with 20.04.

I have no knowledge about what windows does or why.

The kernel configuration dictates what CPU frequency scaling driver and governor will be used by default and during boot. For the current 20.04 kernel, 5.4.0-40-generic (and it doesn't matter if I am behind here):

/boot/config-5.4.0-40-generic the relevant area is:

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

#
# CPU frequency scaling drivers
#
CONFIG_X86_INTEL_PSTATE=y
CONFIG_X86_PCC_CPUFREQ=y
CONFIG_X86_ACPI_CPUFREQ=y
CONFIG_X86_ACPI_CPUFREQ_CPB=y
CONFIG_X86_POWERNOW_K8=y
CONFIG_X86_AMD_FREQ_SENSITIVITY=m
CONFIG_X86_SPEEDSTEP_CENTRINO=y
CONFIG_X86_P4_CLOCKMOD=m

And you can observe the performance governor is the default. This is an Ubuntu thing not a Linux thing.

You can compile your own kernel, specifying a different default governor. Example:

#
# CPU Frequency scaling
#
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_ATTR_SET=y
CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_STAT=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y
# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
# CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL is not set
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y

But such an approach will require ongoing work, as you would have to do it for every kernel update.

I do not think there is way to advance the change the time, as it looks as though Ubuntu runs the change script as soon as is reasonable during the boot process. The related service is called the ondemand.service which calls /lib/systemd/set-cpufreq.

Now, there is often a lot to do durng boot, so your processor might remain consuming a lot of power, even after the governor change until it finishes its startup work.

Related Question