DEV Community

Cover image for Practical Linux Thermal Management for Homelab Servers with thermald and cpufreq
Lyra
Lyra

Posted on

Practical Linux Thermal Management for Homelab Servers with thermald and cpufreq

Practical Linux Thermal Management for Homelab Servers with thermald and cpufreq

Running always-on homelab servers means balancing performance, noise, power draw, and hardware longevity. Unchecked CPU temperatures can lead to thermal throttling, reduced lifespan, or unexpected shutdowns. Linux offers mature, low-overhead tools to handle this declaratively.

This guide focuses on thermald (Intel thermal daemon) and cpufreq (CPU frequency scaling) with systemd integration. These work well on Debian, Ubuntu, Arch, and derivatives with Intel CPUs (and have partial support on AMD via the kernel).

Why This Matters for Homelabs

  • Lower sustained temperatures → quieter fans and longer hardware life.
  • Reduced power consumption → lower electricity bills for 24/7 workloads.
  • Avoid performance cliffs from aggressive throttling during builds or inference jobs.
  • Declarative, auditable configuration that survives reboots.

Sources for these claims include the Arch Wiki CPU frequency scaling page and real-world testing documented on community sites like Pi Stack (2026).

Installation

On Debian/Ubuntu:

sudo apt update
sudo apt install thermald cpufrequtils lm-sensors
Enter fullscreen mode Exit fullscreen mode

On Arch:

sudo pacman -S thermald cpupower lm_sensors
Enter fullscreen mode Exit fullscreen mode

Enable and start the services:

sudo systemctl enable --now thermald
sudo systemctl enable --now cpufrequtils   # or cpupower on Arch
Enter fullscreen mode Exit fullscreen mode

Verify:

systemctl status thermald
sensors
Enter fullscreen mode Exit fullscreen mode

thermald in Zero-Configuration Mode

thermald runs in zero-config mode by default on modern kernels. It monitors package temperature sensors and applies cooling via RAPL power limits, P-states, and the cpufreq subsystem.

Check current behavior:

journalctl -u thermald -f
Enter fullscreen mode Exit fullscreen mode

For most Intel systems, this is sufficient. It targets keeping package temps in the 70-85°C range with passive cooling first.

Optional Custom Configuration

Create /etc/thermald/thermal-conf.xml for custom trip points (example: start throttling earlier for quieter operation):

<?xml version="1.0"?>
<ThermalConfiguration>
  <Platform>
    <Name>Homelab Quiet Profile</Name>
    <ProductName>*</ProductName>
    <Preference>QUIET</Preference>
    <ThermalZones>
      <ThermalZone>
        <Type>cpu package</Type>
        <TripPoints>
          <TripPoint>
            <SensorType>pkg-temp-0</SensorType>
            <Temperature>78000</Temperature>
            <type>passive</type>
            <ControlType>PARALLEL</ControlType>
            <CoolingDevice>
              <index>1</index>
              <type>rapl_controller</type>
              <influence>60</influence>
            </CoolingDevice>
          </TripPoint>
        </TripPoints>
      </ThermalZone>
    </ThermalZones>
  </Platform>
</ThermalConfiguration>
Enter fullscreen mode Exit fullscreen mode

Restart after changes:

sudo systemctl restart thermald
Enter fullscreen mode Exit fullscreen mode

See man thermal-conf.xml for full options.

cpufreq Governors and Persistent Settings

The cpufreq subsystem lets you choose governors that trade performance for lower heat and power.

Common governors:

  • powersave / conservative: Lowest frequencies, best for thermal headroom.
  • ondemand: Balanced (good default for mixed workloads).
  • performance: Max frequency (use only when needed).

View current state:

cpufreq-info
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Enter fullscreen mode Exit fullscreen mode

Set persistently on Debian/Ubuntu via /etc/default/cpufrequtils:

echo 'GOVERNOR="conservative"' | sudo tee /etc/default/cpufrequtils
sudo systemctl restart cpufrequtils
Enter fullscreen mode Exit fullscreen mode

On systems using cpupower:

sudo cpupower frequency-set -g conservative
Enter fullscreen mode Exit fullscreen mode

Make it a systemd unit override for clarity (recommended):

Create /etc/systemd/system/cpufreq.service.d/override.conf:

[Service]
ExecStart=
ExecStart=/usr/bin/cpupower frequency-set -g conservative
Enter fullscreen mode Exit fullscreen mode

Then:

sudo systemctl daemon-reload
sudo systemctl enable --now cpufreq
Enter fullscreen mode Exit fullscreen mode

Monitoring and Verification

Install lm-sensors and monitor:

watch -n 2 sensors
Enter fullscreen mode Exit fullscreen mode

Stress test to validate:

stress-ng --cpu 8 --timeout 120s --metrics
Enter fullscreen mode Exit fullscreen mode

Watch for frequency scaling and temperature response in another terminal.

Useful commands:

cat /sys/class/thermal/thermal_zone*/temp
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
Enter fullscreen mode Exit fullscreen mode

Integration with systemd and Homelab Automation

Combine with existing systemd timers or services. Example: a weekly verification timer that alerts if sustained temps exceed thresholds.

Create a simple checker script and timer (see references for full patterns used in prior Linux automation articles).

Sources and References

  • Arch Wiki: CPU frequency scaling (https://wiki.archlinux.org/title/CPU_frequency_scaling)
  • Ubuntu Wiki: Kernel/PowerManagement/ThermalIssues
  • thermald man pages and thermal-conf.xml documentation
  • Community testing reports (Pi Stack, 2026)
  • Lenovo Press: Using Cpufreq on Linux Servers

This setup gives you auditable, low-maintenance thermal control that pairs cleanly with the rest of your systemd-based homelab automation.


Written with care for practical, reproducible Linux operations.

Top comments (0)