How do I control my laptop's fan speeds?

I’ve been trying to increase my fan speeds as I am thermal throttling in games after a bit. I do this on Windows using LegionFanControl, but unfortunately there is no linux version.

I have tried pwmconfig, which gives There are no pwm-capable sensor modules installed. Lenovo-legion doesn’t seem to work as upon adding the package to my configuration.nix, running the fancurve-set command fails with an error that the maintainer is likely due to the program’s kernel module not being loaded properly, meaning a failed installation.

My next try is going to be thinkfan, but I have low hopes. Running sensors from lm_sensors doesn’t report any fans:

BAT0-acpi-0 Adapter: ACPI interface in0: 17.33 V
nvme-pci-0200
Adapter: PCI adapter
Composite:    +42.9°C  (low  = -273.1°C, high = +83.8°C)
                       (crit = +84.8°C)
Sensor 1:     +42.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +34.9°C  (low  = -273.1°C, high = +65261.8°C)

k10temp-pci-00c3
Adapter: PCI adapter
Tctl:         +54.4°C 

And sudo sensors-detect gives:

Sorry, no sensors were detected.
This is relatively common on laptops, where thermal management is
handled by ACPI rather than the OS.

Any advice on how to set fan curves for laptops? Particularly on lenovo legion laptops? Thanks.

2 Likes

Hello,

I would try to figure out what kind of chip is used by the motherboard to drive the fans, and then see if there is a driver that can be loaded for it. For example on my desktop computer I have to load the nct6775 driver to be able to control fans.

If sensors does not see the fans, I don’t see how anything will be able to control them.

1 Like

Do you have any idea of what commands/resources might have this info? I haven’t found any info from Lenovo. I did find the hwmon list of chips and respective drivers, but am still not sure of the chip type.

I don’t sorry, fwiw I have a thinkpad laptop and the driver for that is thinkpad-acpi, I didn’t have to load it manually (at least on Debian).

I have a legion laptop and this is how I got it working:

# hardware-configuration.nix
  boot.kernelModules = [ "lenovo-legion-module" ];
  boot.extraModulePackages = with config.boot.kernelPackages; [ lenovo-legion-module ];
# configuration.nix
  environment.systemPackages = with pkgs; [
    lenovo-legion
  ];

After rebooting the machine, all legion commands (CLI/GUI) work successfully. For example:

$ sudo fancurve-set
Applying Balance Mode Profile   -> charger...
Successfully wrote preset /nix/store/nhs5shafqfwnjv37bh8427vn8i93341h-lenovo-legion-app-0.0.12/share/legion_linux/balanced-ac to hardware

Before this, I’ve also tried setting up CoolerControl, which has a nicer GUI in my opinion, but I either didn’t know how to configure it or my changes weren’t taking effect.

In any case, if you’d like to try it, all you need to do is:

# configuration.nix
  programs.coolercontrol = {
    enable = true;
    nvidiaSupport = true;
  };

If anyone knows how to use it, please let me know.

3 Likes

sudo fancurve-set still gives sudo: unable to execute /run/current-system/sw/bin/fancurve-set: No such file or directory, however, the /run/current-system/sw/bin/fancurve-set file does exist.

I was able to run legion_gui and edit fan values, but I can’t save any profiles since the /nix/store is read-only

OSError: [Errno 30] Read-only file system: '/nix/store/yqq8zf38rm6b2jwcgjghqxiwqilm4hs8-lenovo-legion-app-0.0.12/share/legion_linux/settings.yaml'
zsh: IOT instruction  sudo legion_gui

Did you find a work around for this?

Thanks for your help, I feel this is the closest I have gotten haha.

EDIT:

Currently, my best solution is to create a fans.txt that will run at boot and set the fan profile using sudo legion_cli fancurve-write-file-to-hw fans.txt. At least this way I have some reproducibility and can save the profile.

1 Like

Unfortunately, I don’t think you can save fan values to a new preset (for the gui), but you can still apply them to the fan.

That’s actually a nice solution for custom fan curves, thanks!