Thinkpad T470s power management

Hey, nix noob here. I ran ubuntu on my system for about a year and it ran cool with not at all noisy fans. I’m aware ubuntu uses the powersave mode for the cpu.

Ever since I installed nix my laptops been running a bit hotter than normal and the fan gos crazy when I play a video on youtube or do something remotely intensive.

I’ve tried doing the following.

I installed lm_sensors and ran sensors-detect

and added the following to my nix configuration:

   powerManagement = { 
        enable = true; 
        cpuFreqGovernor = "powersave"; 
   };
   powerManagement.powertop.enable = true;
   services.thermald.enable = true;

   boot.kernelModules = [ "coretemp" "cpuid" ];

Any help would be greatly appreciated. Thanks

Edit:

I tried using this config:

with no success. The fan still goes crazy when I open youtube or something.

This is what I used in ubuntu and worked just fine:

https://www.dannycroft.co.uk/saving-power-on-a-carbon-x1-ubuntu-14-04/

I should mention that when left untouched the computer idles nicely at around 45-49 Celsius.

I don’t have a great battery life yet and will check your options (t460p user here), but here are the relevant bits of my config to make it a little better:

  boot.extraModprobeConfig = lib.mkMerge [
    # idle audio card after one second
    "options snd_hda_intel power_save=1"
    # enable wifi power saving (keep uapsd off to maintain low latencies)
    "options iwlwifi power_save=1 uapsd_disable=1"
  ];

  services.tlp = {
      enable = true;
      extraConfig = ''
        CPU_SCALING_GOVERNOR_ON_AC=performance
        CPU_SCALING_GOVERNOR_ON_BAT=powersave
      '';
    };

  services.udev.extraRules = lib.mkMerge [
    # autosuspend USB devices
    ''ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"''
    # autosuspend PCI devices
    ''ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control", ATTR{power/control}="auto"''
    # disable Ethernet Wake-on-LAN
    ''ACTION=="add", SUBSYSTEM=="net", NAME=="enp*", RUN+="${pkgs.ethtool}/sbin/ethtool -s $name wol d"''
  ];

  boot.initrd.availableKernelModules = [
        # trimmed irrelevant ones
        "thinkpad_acpi"
      ];


Also you can check the tunables section of powertop tool for small individual hints.

2 Likes

Thanks! that helped a lot.

I added the t470s config from

and the following to my config file:

services.tlp = {
      enable = true;
      extraConfig = ''
        CPU_SCALING_GOVERNOR_ON_AC=performance
        CPU_SCALING_GOVERNOR_ON_BAT=powersave
      '';
    };

  boot.initrd.availableKernelModules = [
        # trimmed irrelevant ones
        "thinkpad_acpi"
      ];
  services.upower.enable = true;

Now, it runs a bit more cool with quite fans when unplugged (powersave mode) but when its connected to AC and its running on performance mode it runs really hot and loud still. (a bit less so than before i must say tho)

However it still run considerably louder than ubuntu or arch. With those the laptop was completely silent most of the time. With nixOS it still turns on the fans on when opening the web browser.

I have these config on my ThinkPad X1E2 (i7 9750H). I think the power consumption is quite great, only 6-8W when running on Intel GPU, low brightness with a chrome brower and some terminal open.

    boot.kernelPackages = pkgs.linuxPackages_latest;
    boot.kernelParams = ["intel_pstate=disable"];
    services.tlp = {
      enable = true;
      extraConfig = ''
        START_CHARGE_THRESH_BAT0=75
        STOP_CHARGE_THRESH_BAT0=80

        CPU_SCALING_GOVERNOR_ON_AC=schedutil
        CPU_SCALING_GOVERNOR_ON_BAT=schedutil

        CPU_SCALING_MIN_FREQ_ON_AC=800000
        CPU_SCALING_MAX_FREQ_ON_AC=3500000
        CPU_SCALING_MIN_FREQ_ON_BAT=800000
        CPU_SCALING_MAX_FREQ_ON_BAT=2300000

        # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
        # A value of 0 disables, >=1 enables power saving (recommended: 1).
        # Default: 0 (AC), 1 (BAT)
        SOUND_POWER_SAVE_ON_AC=0
        SOUND_POWER_SAVE_ON_BAT=1

        # Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
        # Default: on (AC), auto (BAT)
        RUNTIME_PM_ON_AC=on
        RUNTIME_PM_ON_BAT=auto

        # Battery feature drivers: 0=disable, 1=enable
        # Default: 1 (all)
        NATACPI_ENABLE=1
        TPACPI_ENABLE=1
        TPSMAPI_ENABLE=1
      '';
    };
3 Likes

i’ll give it a try. thanks.

I’ll let you know how things went

Now this is the winner config right here.

Fans are SILENT now, nice temps and my system draws about 7W on average running chromium, texstudio, and some terminal consoles with low brightness.

Now I just have to see how much battery life I can get out of the system. I’ll report back.

I prefer to keep the fan running at minimum speed instead of no spinning at all. Sometime you need to run some heavy stuff and the CPU become hot, so it draw more power and become hotter and so on. With the fan is on, I can keep the laptop at 31C-33C compared to 38C-43C when the fan is off (I tested this in Ubuntu). My problem with NixOS is that the fan is not spinning even if the temp is 55C. I tried thinkfan but only can only control 1 fan. I’m hoping the linux kernel 5.8 could solve that problem: https://www.phoronix.com/scan.php?page=news_item&px=ThinkPad-Dual-Fan-Control-5.8#:~:text=Linux%205.8%20Will%20Finally%20Be,Laptops%20With%20Dual%20Fans%20-%20Phoronix&text=Long%20overdue%20but%20for%20Lenovo,ability%20to%20control%20both%20fans.

Unfortunately, current Nvidia dkms can not be compiled with kernel 5.8