Linux Mint 15 on Lenovo Thinkpad T420s, Installation and tweeks

This is an unedited republication of how I installed Linux on my then new laptop. The post first appeared on larsee.dk. Some of the tips are out of date now, so this is mostly for the historical perspective. I am still using that same old T420s as of writing this. It's the most reliable computer I have ever owned. Here is a more recent post about installing Linux Mint 18 on the same machine.

Lars, March 2018

This post describes how I installed and tuned Linux Mint 15 32-bit Mate edition to run nicely on a Lenovo T420s with SSD to get a good performing and portable Linux system.

Thinkpad T420s with linux

I did the install and wrote most of the following text in July 2013. In the following six months I have used the system, the experience has been positive, generally. It is a fast, light, reliable laptop with 4 – 5 hours of battery life. There are minor glitches now and then, like the standby feature doesn’t resume correctly every time (the GPU sometimes wakes up in the highest power mode and can’t throttle down resulting in poor battery life). But I just shut down and boot every time, it doesn’t take too long.

Why the TP420s

My requirements were: a light and portable unit with a good trackpoint navigating device, a good keyboard feel and layout (which unfortunately rules out most of the newer Thinkpads…), a high resolution screen, SSD, a medium spec. CPU and GPU, good battery life and a good docking station available.

The Lenovo ThinkPad T420s meets most of these requirements and while it is already old, it seems to be the newest and most portable ThinkPad in 14 inch size you can get with a classic keyboard layout. Though, its definitely not perfect. The screen could be bigger and better, and the battery capacity is not impressive at all. But it is thin and light, and the build quality is great.

The T420s is pretty slim and light

Why Linux Mint 15 32-bit Mate

Well, I’m used to Debian / Ubuntu based distros and Mint has worked really well for me before. The hard decision was to decide between 32-bit and 64-bit, and between MATE and Cinnamon. I chose 32-bit as the machine only has 4 GB of RAM, and MATE because, well, you have to start with one of them.

UPDATE: Now, 6 monts later, I’m still happily running the Mate install, I like the nice and slim window decorations in Mate which saves a bit of screen space compared to other window managers.


I ordered the Laptop with SSD and it came with a 128 GB Toshiba SSD unit. My goal was to have a dual boot setup with both the factory Windows 7 and Linux Mint, so I made an image of all the partitions, deleted the Lenovo restore partition (last partition) and resized the Windows partition. I decided to free about 52 GB of space for the Linux install, leaving 66 GB for Windows 7. (Update: This proportion turned out to be a good split between Windows and Linux needs for disk space.)

The Linux Mint 15 32-bit Mate installed like a breeze from a bootable USB. Everything practically worked out of the box. But to really get perfect performance I did the following couple of tweeks:

SSD tuning

All I did here was to add noatime for the mount command. In my opinion it’s a game of diminishing returns, with increasing risk of problems, to implement all the special SSD performance enhancing tricks you may find various places on the net. The noatime flag however is worth it, as it disables the writing of a new value in the file access time/date field every time a file is accessed. This feature is rarely used, and as files are accessed a lot turning this off saves a lot of small writes to the SSD that wears the drive unecessarily and probably slow things down:

$ sudo nano /etc/fstab

then add ",noatime" in options for the / mount. Reboot and try mount to verify that / is mounted with noatime option:

$ mount
/dev/sda5 on / type ext4 (rw,noatime,errors=remount-ro)

Increasing trackpoint speed

The trackpoint is one of my favorite navigational devices for laptops. But it must be set to a pretty high speed to work well for me. If you simply increase the general mouse speed it will also affect the touchpad and external mouse speeds. It has to be done at the trackpoint driver level. I couldn’t find the settings in any GUI config, but it is possible to adjust by command line:

1. Experiment with the speed / sensivity values with:

$ echo -n 80 > /sys/devices/platform/i8042/serio1/serio2/speed 

$ echo -n 250 > /sys/devices/platform/i8042/serio1/serio2/sensitivity

2. To make the favorite settings permanent, create a /etc/udev/rules.d/trackpoint.rules file containing:

SUBSYSTEM=="serio", DRIVERS=="psmouse", WAIT_FOR="/sys/devices/platform/i8042/serio1/serio2/sensitivity", ATTR{sensitivity}="250", ATTR{speed}="80"

3. Reboot or use the following to load the new settings:

$ sudo udevadm control --reload-rules
$ sudo udevadm trigger 

Improving fan control

The built-in hardware fan control has a tendency to ramp up to ~4000 RPM and stay there, which is quite audible and not at all necessary. I managed to implement a custom temperature regulation (use at your own risk!) with the thinkfan tool:

1. Install required packages

$ sudo apt-get install lm-sensors thinkfan

Run sensors once and let the tool configure the sensors.

2. Enable software fan control by creating file /etc/modprobe.d/thinkfan.conf containing:

options thinkpad_acpi fan_control=1

3. Create or edit /etc/thinkfan.conf to select the right sensors and fan speed rules. This is what I use:

sensor /sys/devices/platform/coretemp.0/temp1_input (0)
sensor /sys/devices/platform/coretemp.0/temp2_input (0)
sensor /sys/devices/platform/coretemp.0/temp3_input (0)
sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input (0)

(0,     0,      40)
(1,     35,     45)
(2,     40,     51)
(3,     42,     53)
(4,     46,     60)
(5,     53,     66)
(7,     60,     72)
(127,   70,     32767)

4. I prefer to run the thinkfan tool with 5 seconds poll interval (-s 5) and no “exaggeration” on rising temperature (-b 0). I installed the tool as an upstart service by creating /etc/init/thinkfanservice.conf containing:

exec /usr/sbin/thinkfan -s 5 -b 0.0 -q -n


start on runlevel [2]

5. Check status / start / stop of service with:

sudo initctl status thinkfanservice
sudo initctl start thinkfanservice
sudo initctl stop thinkfanservice

You can test the current temperatures and fan speed with the sensors command:

$ sensors
Adapter: Virtual device
temp1:        +38.0°C  (crit = +97.0°C)

Adapter: ISA adapter
fan1:        1973 RPM

Adapter: ISA adapter
Physical id 0:  +42.0°C  (high = +86.0°C, crit = +100.0°C)
Core 0:         +42.0°C  (high = +86.0°C, crit = +100.0°C)
Core 1:         +39.0°C  (high = +86.0°C, crit = +100.0°C)

Battery life optimization

I managed to tweak battery life to a pretty respectable typical 5 hours. This is what I did:

1. Bluetooth radio default off. I don’t use bluetooth and don’t want to manually turn it off all the time. This is the only way I found to reliably turn it off after boot, in a way where you can still turn it on using the tray icon:

Edit /etc/rc.local and add:

rfkill block bluetooth

2. Install power mode changing script. This script sets a lot of hardware settings depending on AC / battery power state. Create file /etc/pm/power.d/power with execution rights containing:


 # Shell script to reduce energy consumption when running battery. Place
 # it in /etc/pm/power.d/ and give execution rights.

 if on_ac_power; then

 # Start AC powered settings --------------------------------------------#

 # Disable laptop mode
 echo 0 > /proc/sys/vm/laptop_mode

 #NMI watchdog should be turned on
 for foo in /proc/sys/kernel/nmi_watchdog;
 do echo 1 > $foo;

 # Set SATA channel: max performance
 for foo in /sys/class/scsi_host/host*/link_power_management_policy;
 do echo max_performance > $foo;

 # CPU Governor: Performance
 for foo in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
 do echo performance > $foo;

 # Disable USB autosuspend
 for foo in /sys/bus/usb/devices/*/power/level;
 do echo on > $foo;

 # Disable PCI autosuspend
 for foo in /sys/bus/pci/devices/*/power/control;
 do echo on > $foo;

 # Disabile audio_card power saving
 echo 0 > /sys/module/snd_hda_intel/parameters/power_save_controller
 echo 0 > /sys/module/snd_hda_intel/parameters/power_save

 # End AC powered settings ----------------------------------------------#


 # Start battery powered settings ---------------------------------------#

 # Enable Laptop-Mode disk writing
 echo 5 > /proc/sys/vm/laptop_mode

 #NMI watchdog should be turned on
 for foo in /proc/sys/kernel/nmi_watchdog;
 do echo 0 > $foo;

 # Set SATA channel to power saving
 for foo in /sys/class/scsi_host/host*/link_power_management_policy;
 do echo min_power > $foo;

 # Select Ondemand CPU Governor
 for foo in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
 do echo ondemand > $foo;

 # Activate USB autosuspend
 for foo in /sys/bus/usb/devices/*/power/level;
 do echo auto > $foo;

 # Activate PCI autosuspend
 for foo in /sys/bus/pci/devices/*/power/control;
 do echo auto > $foo;

 # Activate audio card power saving
 # (sounds shorter than 1 seconds will not be played)
 echo 1 > /sys/module/snd_hda_intel/parameters/power_save
 echo 1 > /sys/module/snd_hda_intel/parameters/power_save_controller

 # End battery powered settings -----------------------------------------#


Thats it!

Selected responses from larsee.dk:

Jonathan A says:
October 22, 2014 at 19:03

Hey, thanks for the post. The power management script made my T420s go from one/two hours to three/four hours of battery life.

The other differences in my setup is that I’m using Ubuntu 14.04 with disk encryption so I chose not to enable noatime in fstab. I’m also using different thinkfan values with temperature increments of +5 starting from 45. It keeps my system quiet for the most part.


Lars Ole Pontoppidan says:
October 23, 2014 at 20:39

Hi Jonathan

I’m happy the script helped your T420s battery!

Let me add that I use Linux Mint 17 Mate these days and it runs great. I did more or less the same tweeks with Mint 17 as I did with Mint 15.

Lippman says:
October 25, 2014 at 13:22

Lars, thanks so much for sharing your configuration settings. I also am running Mint 17 on a T420s. The fan tweak you shared quiet the fan that was annoying me. Thanks again.

Ben says:
November 25, 2014 at 01:08

Thanks for these settings. I’ve got a t420s running Mint 64-bit Xfce and you’ve resolved my main annoyances!

SK says:
June 17, 2015 at 03:05

By the way, since the newer kernels default to relatime, the noatime option has very little performance benefits, with the potential side effect of breaking applications that rely on the timestamps to be accurate. Sticking with the default should be the best choice now.


Comments powered by Talkyard