See below for the setup procedure I use for my T420 laptop.
The setup procedure for my old T400 laptop is archived on another page.
Install Linux on a Thinkpad T420
My T420 came with Windows 7 already installed. To install Linux, I first had to shrink the Windows 7 partition on the disk using the built-in Windows disk utility. I shrank the Windows partition so that I have approximately 160 GB for Windows and 160 GB for Linux.
Next, I inserted a USB thumb drive with a Live Ubuntu 16.04 image on it and booted to Linux on the USB drive. I followed all the prompts and successfully installed Ubuntu in a dual-boot configuration so I can choose between running Windows or Ubuntu when I start the computer.
Ubuntu Linux works very well on Thinkpads so the installation should be painless and Ubuntu should automatically set up a dual-boot system if Windows is already installed on the laptop.
Configure BIOS settings
First, check that the NVIDIA Optimus feature is enabled and that the Intel VT-x extensions are enabled on the T420’s BIOS. Follow the instruction below. ((Mostly from https://support.lenovo.com/ca/en/documents/ht062424))
- To enter BIOS setup, press the F1 key or the Thinkpad key when the Lenovo / ThinkPad logo is displayed when first powering on the system.
- Select Config on the first screen.
- Select Display on the second screen.
- For the Graphics Device selection, change NVIDIA Optimus to Optimus.
- Additionally, OS Detection for NVIDIA Optimus should be enabled.
- Select Security
- Enable Virtualization Hardware Support
- Press the F10 key to save the changed selections and exit BIOS setup
The computer will boot. If the system is a dual-boot configuration, select Ubuntu and let it start up.
NVIDIA graphics in Linux on Thinkpad T420
By default, Ubuntu Linux uses the NVIDIA graphics chip if it is installed. This offers high performance but it used up battery power a lot faster than the Intel graphics. The T420 supports switchable graphics so, to improve battery life, you may install the NVIDIA driver that will allow you to enable and disable the NVIDIA graphics chip so you can choose between performance and battery life.
Open the Additional Drivers application and choose the tested NVIDIA driver. This will install the NVIDIA driver and the nvidia-prime graphics switching utility.
Restart the computer and login again.
Next, in a terminal window, start the GUI tool to set NVidia settings.
$ nvidia-settings
Set the video card in the PRIME Profiles tab. Choose the Intel graphics card.
Logout and login again to activate the change.
To verify that the Intel graphics are running, in a terminal window execute the following command:
$ prime-select query
intel
This shows that the integrated Intel graphics is being used.
To switch back to NVIDIA, or to switch to Intel if already running the NVIDIA graphics chip, Execute either of the following commands in a terminal window and then log out and log back in.
To switch to NVIDIA discreet graphics to maximize 3D performance:
$ sudo prime-select nvidia
To switch to Intel integrated graphics to maximize battery life:
$ sudo prime-select intel
Instead of using the CLI commands above to switch graphics modes, I suggest you install a graphics speed-switching utility, prime-indicator, that will allow you to switch graphics from the Ubuntu GUI.
$ sudo su
# add-apt-repository ppa:nilarimogard/webupd8
# apt-get update
# apt-get install mesa-utils prime-indicator
After restarting, you will see the “Intel” logo in the menu bar. Click on it to see the current driver status and to switch graphics cards.
Whenever you switch graphics cards, you need to restart the X server by logging out and logging back in. I do not expect to need the higher-performance graphics so this is not an issue for me.
An alternative: Bumblebee
Users who want a more advanced graphics configuration that will allow them to switch graphics cards without restarting the X server and to enable some specific programs to start the NVIDIA graphics when they start may consider installing Bumblebee.
There are many guides online showing how to install Bumblebee — examples are here and here — but I chose to keep things simple, for now, and just use the NVIDIA Prime driver to manually switch when I need higher performance.
NVIDIA Graphics and Windows
The T420 I purchased came with Windows 7. When I booted up Windows 7, it offered a free upgrade to Windows 10. I chose not to upgrade to Windows 10 because it is not clear if the NVIDIA Optimus graphics switching technology will be supported in Windows 10.
Lenovo does not officially support the T420 with Windows 10 so they will not provide updated Windows 10 drivers. Without the right drivers for the NVIDIA chip and for power management, battery life may be much shorter in Windows 10.
For now, I will keep Windows 7 so that the NVIDIA chip and power management feautres continue to provide good battery life when I run Windows.
Install other useful software
For my purposes, which are blog writing and research into network simulation tools, I find the following programs are necessary. Install them from the Ubuntu Software Centre.
- Pinta
- An easy-to-use image editor
- ReText
- A markdown editor for blog posts
- ImageMagick
- A set of powerful command-line image manipulation utilities. I use it to quickly add borders and resize an image
- DropBox
- A file sharing tool that syncs files with a cloud storage account
- Useful when working on a project on different computers
- VirtualBox
- An easy-to-use cross-platform virtual machine manager
- lm-sensors
- a nice-to-have utility to check CPU temperature and fan speed
- Wine
- A set of drivers that allows you to run some Windows programs on Linux
- Note: If you get error using Wine, install the winbind package and try again.
- Scrivener
- My preferred writing program for long blog posts. I install the Windows version using Wine. After downloading the Scrivener installer from the Scrivener web site, run the command:
wine Scrivener-installer.exe
.
- My preferred writing program for long blog posts. I install the Windows version using Wine. After downloading the Scrivener installer from the Scrivener web site, run the command:
Optional software and setup
If your T420 has a fingerprint reader you may wish to use it. To enable fingerprint security, install the fprint program using the following command:
$ sudo apt-get install libfprint0 fprint-demo libpam-fprintd
Now test your fingerprint reader with the fprint_demo program:
$ fprint_demo
This will open up a screen that shows your fingerprints when you scan them. If this works OKm then go ahead and enroll your fingerprint as a security password. Execute the fprintd-enroll command:
$ fprintd-enroll
Swipe your right index finger five times across the fingerprint reader and you are ready to go. Now both your login window and sudo commands will ask you to swipe your finger instead of entering a password.
If you ever want to disable fingerprint authentication, read the fingerprint-disable procedure written by Mopar4Life. In summary, use the command:
$ sudo pam-auth-update
This will open a windows in terminal which allows us to add or remove methods for authentication. Just unselect all the methods containing the word finger and you are back to normal password prompt windows. ((from http://www.blog.webcare.pk/2013/02/how-to-disable-fingerprint-gui-in.html))
Install and set up network simulators
I like to install and set up my commonly-used network simulators. Currently, I use GNS3, CORE, Cloonix, and Mininet.
- Install GNS3 and set GNS3 up with open-source appliances
-
Set up networking so the default NetworkManager app does not interfere with network simulations Remove NetworkManager, install WICD
- Note that this step may no longer be needed in Ubuntu 16.04. The Ubuntu project team significantly improved the way Network Manager works on a computer running virtual machines and virtual Ethernet interfaces. I suggest you first check to see if you have any problems before removing Network Manager.
-
Fix some issues with CORE and Xubuntu
-
Fix the Quagga VTY shell problem
-
Download and set up Mininet virtual machine
Pingback: Lenovo T400: now an excellent, inexpensive laptop | Open-Source Routing and Network Simulation
Nice write up. I’ll be referring back to it in the next week or so. I just bought a T420 on Ebay and will be loading it with Ubuntu.
Question about resizing the windows partition. Mine is coming preloaded with Win7. It’s got a 128 Gig SSD. Any suggestion on the size that I should shrink this to? If needed, I can just wipe it and go full Ubuntu. I don’t really see myself using Windows that often. But since it’s there, it would be nice to keep it.
Hi Greg,
Thanks for your comment! It depends on how you will use it. I think Windows will need at least 50G to be useful (since you may be using more media files in Windows). If I was you, I’d split it 64G/64G. I agree having Windows is useful for the times you need to test something in that operating system.
–Brian
That’s what I decided to do, split it right down the middle. Ubuntu installed without issue, of course. I will need to go back over your post to see if anything I forgot about needs configured differently than default.
I plan on picking up one of the smaller mSata drives and moving my home directory to that. I still have need for an optical drive, so I’ll leave that in place.
I want to drop a line and say thank you for this write up. I haven’s seen this information anywhere but here.
Regarding cheap batteries from China, mentioned in the talk about T400:
I have bought batteries both for Thinkpads and Dell’s over ebay from China and never had an issue with batteryfailure or such. Working fine, maybe the performance is slightly lower then original new ones, but I never noticed ’cause I only buy Thinkpads and Dell’s used. So for me cheap chinese batteries are the deal to breath life into older used laptops. And by the way the “original batteries” are usually also “Made in China”.
Pingback: The Wistar network emulator | Open-Source Routing and Network Simulation
Thanks for this great tutorial.
I’m helping a friend put Linux on his t420. It will be the only operating system. Could you recommend the Ubuntu version I can download and set up for him?
Many thanks. Your article is brilliant! 🙂
Hi Richard, I am running Ubuntu 20.04 on my T420 now and it works great.