Configuring Linux on a ThinkPad T420s Laptop (Debian, Ubuntu, Linux Mint…)

ThinkPad T420s laptops, despite their age, remain reliable for web browsing, word processing, and various other tasks. Linux can breathe new life into such dated computers, allowing them to perform efficiently.

I configured one of these laptops for my son, and he is now able to do his homework using it. With proper configuration, ThinkPad laptops can achieve optimal performance and power management. This article provides a guide to configuring X11/Xorg, kernel parameters, firmware, fan control, and power management settings to optimize the ThinkPad t420s for modern use.

Some instructions in this article are specific to Debian/Ubuntu-based distributions, but they can easily be adapted to other distributions such as Red Hat, Fedora, Arch Linux, Gentoo, and others.

X11/Xorg

To ensure proper functionality of Intel graphics and avoid visual tearing, use the kernel’s built-in modesetting driver.

Create the configuration file /etc/X11/xorg.conf.d/30-intel.conf:

Section "Device"
  Identifier "Device0"
  Driver "modesetting"
  Option "TearFree" "True"
EndSection
Code language: plaintext (plaintext)

IMPORTANT: Ensure that the integrated graphics are set as the default video card in the ThinkPad BIOS.

Enabling the TearFree option in the Xorg modesetting driver is a good way to eliminate screen tearing on the ThinkPad T420s. This option forces the driver to use a shadow buffer and synchronize frame flips with the display’s vertical blanking interval. Although TearFree allocates a small amount of additional memory and introduces a negligible amount of input latency, it provides a better visual experience for general desktop usage.

Kernel parameters

On a Debian/Ubuntu based distribution, kernel parameters can be appended to the kernel command line in the bootloader configuration, typically in /etc/default/grub (for GRUB users):

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"Code language: plaintext (plaintext)

Here are some GRUB_CMDLINE_LINUX_DEFAULT parameters that may be useful:

  • If you experience issues with the backlight control (increasing and decreasing brightness), add the following kernel parameter: acpi_backlight=native
  • If you experience system freezes, try adding the following kernel parameter: i915.enable_fbc=0

(On a Debian or Ubuntu-based distribution, update GRUB with the following command after modifying this file: sudo update-grub)

Fan control

Without software to control the fan, it may run at maximum speed. To enable fan control, create the file /etc/modprobe.d/thinkpad_acpi.conf:

options thinkpad_acpi fan_control=1Code language: plaintext (plaintext)

After that, install zcfan. On a Debian/Ubuntu based distribution:

sudo apt-get install lm-sensors zcfanCode language: plaintext (plaintext)

(An alternative to zcfan is thinkfan, which requires slightly more configuration. The advantage of zcfan is that it functions out of the box.)

Packages

Ensure that the required firmwares are installed. On Debian- and Ubuntu-based distributions, install the following packages:

sudo apt install firmware-atheros firmware-realtek firmware-brcm80211Code language: plaintext (plaintext)

It is also recommended to install essential packages for hardware encoding and decoding, including intel-microcode for the latest processor updates, which improve system stability and performance:

sudo apt-get install intel-microcode i965-va-driverCode language: plaintext (plaintext)

TLP

TLP is a power management tool that optimizes battery life. Install and configure it as follows:

sudo apt install tlpCode language: plaintext (plaintext)

Create the configuration file /etc/tlp.d/00-base.conf:

DEVICES_TO_DISABLE_ON_BAT="bluetooth wwan"
DEVICES_TO_ENABLE_ON_STARTUP="wifi"
DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"

TLP_DEFAULT_MODE=BAT

# PCIe Active State Power Management (ASPM):
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersupersave

# Battery Care -- Charge thresholds
# Charging starts when the charge level is below the
# START_CHARGE_THRESH value when the charger is connected. It
# stops when the STOP_CHARGE_THRESH value is reached.
START_CHARGE_THRESH_BAT0=80
STOP_CHARGE_THRESH_BAT0=90

# Sound card power saving
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1

# Wi-Fi power saving
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on

# SATA link power management
#
# Using "medium_power" instead of "min_power" is safer because it avoids the
# deepest SATA link sleep state. It's a known issue that some SSD controllers
# fail to wake up from deep sleep correctly, leading to SATA link resets, I/O
# timeouts, frozen systems, and potential data corruption. The "medium_power"
# setting limits the link to a "Partial" sleep state, which still reduces power
# consumption but maintains high hardware stability and prevents these drive
# lockups.
SATA_LINKPWR_ON_BAT="medium_power"
SATA_LINKPWR_ON_AC="max_performance"

# CPU energy/performance policies
CPU_ENERGY_PERF_POLICY_ON_AC=performance
CPU_ENERGY_PERF_POLICY_ON_BAT=power

# Turbo Boost: Disabled on battery
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0

# Runtime Power Management for PCIe bus devices: on=disable, auto=enable.
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=autoCode language: Python (python)

Conclusion

The ThinkPad T420s, though older models, remain reliable machines for everyday tasks. With the right configuration, these laptops can be revitalized, making them well-suited for modern use.