Linux on the ThinkPad T420s

Allin Cottrell <cottrell at>, July 15, 2011

Wake Forest faculty and students are issued new Lenovo ThinkPads on a two-year rotation. The model I have currently (as of July 2011) is the T420s. And a nice machine it is too.

Specs | Linux summary | Installation | Wrinkles


We have the model 4173A47 with 3GB RAM and Intel graphics. It comes with Windows 7 installed. See here and here for details.

Linux summary

Basically, modern Linux "just works" on this machine. As of this writing I'm using kernel and Xorg server 1.10.3. The Intel HD3000 graphics are supported nicely, with direct rendering enabled. From glxinfo:

display: :0  screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
OpenGL vendor string: Tungsten Graphics, Inc
OpenGL renderer string: Mesa DRI Intel(R) Sandybridge Mobile x86/MMX/SSE2
OpenGL version string: 2.1 Mesa 7.12-devel (git-b6df603)

Regarding the kernel modules in use, audio is supported by snd-hda-intel, ethernet by e1000e, wifi by iwlagn, built-in webcam by uvcvideo, video by agpgart and i915. The TrackPoint/Touchpad and extra keys are handled as I described for the ThinkPad T60p back in 2007.

Installation details

I don't use a Linux "distro" -- I have a system of my own that I have fine-tuned over the years. When I get a new ThinkPad, I back up the old system to DVD in the form of gzipped tarfiles. After setting up the new hard drive, I copy the system over and tweak it as needed for the new machine.

My basic strategy:

  1. In Windows 7, copy my back-up tarballs to a suitable location on the C: drive.
  2. Boot from a Linux SystemRescue CD. Use the on-board tools such as ntfsresize, fdisk, mkswap and mke2fs to repartition and prepare the hard drive.
  3. Boot Windows 7 to check the resized NTFS partition.
  4. Reboot from the SystemRescue CD. Mount both the NTFS partition and the new Linux partition. Decompress my back-up files from the former onto the latter. Then run lilo with chroot: that's lilo -S /boot -r /mnt/linux, assuming that the new Linux partition is mounted on /mnt/linux.
  5. Boot Linux natively using lilo.

The WFU T420s comes with the 320GB hard drive already carved into three partitions: some sort of Windows boot partition then drives C and D, with drive D being used for user-specific data. In previous years there was just a single C drive (/dev/sda1 under Linux), and I set up /dev/sda2 for swap and /dev/sda3 for a Linux filesystem. This time I shrank the D drive (/dev/sda3) and added /dev/sda4 for the Linux filesystem. Since only four primary partitions are supported and I didn't want to mess with extended partitions, I didn't create a swap partition on this machine; instead I created a swapfile once I had Linux running.

So after re-partitioning my hard drive looks like this:

Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x3c168f3a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   245762047   122777600    7  HPFS/NTFS/exFAT
/dev/sda3       245762048   329653799    41945876    7  HPFS/NTFS/exFAT
/dev/sda4       329653800   625137344   147741772+  83  Linux

After getting Linux up and running I check the kernel config against the machine features to see if any modifications are called for, and recompile as needed. One point to note about the T420s is that the Intel Core i5 has two "real" cores but also Hyper-Threading, so it appears to the OS as four cores. To get full support from the kernel, therefore, it's necessary to set CONFIG_NR_CPUS to at least 4.

A few wrinkles

A few things were slightly problematic at first.

So at this point I'm mostly a happy camper, but it'll be nice to have full support for thermal control on the T420s.