Lenovo x201 and Ubuntu 14.04
Recently I’ve bought a refurbished lenovo thinkpad x201 online and I’ve installed the new Ubuntu 14.04 on it. These are my finding on how to customize it for my personal taste.
If you have a Thinkpad and want to know its hardware and install Linux with more insight, make sure to read thinkwiki.org. This is a volunteered site with useful suggestions about all the Lenovo family.
First of all I suggest to limit the speed of the CPU before incurring in overheating and an unexpected (and very quick) forced shutdown. To limit the CPU I found very practical the use of the cpu scaling indicator which can be installed by:
$ apt-get install indicator-cpufreq
$ indicator-cpufreq &
This will add a new icon to the Unity bar and let you choose a frequency:
On a Launchpad I’ve found a suggestion about the thinkfan package which I’ve installed:
$ apt-get install thinkfan
You must configure it to meet your requirements. The syntax is formed by a list of three values:
(LEVEL, LOW, HIGH)
where LEVEL is a number between 1 and 7 in the thinkpad fan scale (1 low rotations, 7 max rotations). LOW is the thermal temperature that moves the fan to the previous level, while HIGH is does the opposite, raising the rotation level.
When I’ve restarted thinkfan:
$ service thinkfan restart
I’ve noticed in /var/log/syslog that it has not access to the ACPI interface and a warning about not using themperature correction:
May 17 15:01:39 gromit thinkfan: WARNING: You're using simple temperature limits without correction values, and your fan will only start at 55 °C. This can be dangerous for your hard drive.
May 17 15:01:39 gromit thinkfan: /proc/acpi/ibm/fan: Permission denied#012Error opening /proc/acpi/ibm/fan. Is this a computer really Thinkpad? Is the thinkpad_acpi module loaded? Are you running thinkfan with root privileges?
To give thinkfan access to the fan control I’ve created a file named /etc/modprobe.d/thinkpad_acpi.conf with this contents:
options thinkpad_acpi fan_control=1
and I’ve modified the file /etc/defaults/thinkfan setting START=yes. Since the module thinkpad_acpi is always in use when Unity is up, I had to reboot. After rebooting the cpu frequency was again set to “On demand” so I’ve adjusted again to 1.6GHz as long as I’m not sure that thinkfan will properly perform its duty.
When configuring thinkfan make sure to overlap the levels. For example this is a wrong configuration:
...
(4, 52, 55)
(5, 60, 65)
...
because level 4 and 5 does not overlap! A proper configuration could be:
...
(4, 52, 55)
(5, 54, 60)
...
Thinkfan does not extensively check its config file so you have to double check your config, since you can blow your hardware by mistake. But not overlapping levels are one of the thinks the software checks, so it will not start if you have not overlapping levels.
I’ve noticed that on x201 the ACPI report only one temperature:
$ cat /proc/acpi/ibm/thermal
temperatures: 49 0 0 0 0 0 0 0
So I’ve lowered a bit all the levels from the example configuration file to avoid blowing by hard drive. Then I’ve started thinkfan with:
$ service thinkfan start
When the situation has cooled down a bit, I’ve addressed another problem: the keyboard layout. The Thinkpad keybord has a great touch and response and typing on it is a pleasure. But I don’t agree on some choices made by its designer. For example the ESC key is in a remote top left corner, over the F1 key. As a customary user of the vi editor, I kept hitting F1 and being prompted by the on-line help. I’m also used to have page-up and page-down keys nearer to the arrow keys, but the x201 keyboard moved them on the top right corner, quite far away.
So I’ve changed some mapping using the xmodmap utility. First of all I’ve used the xev command to get the keycodes and then I’ve dumped the current keymap with
$ xmodmap -pkm > ~/.Xmodmap
to customize it. I’ve changed the following lines:
keycode 9 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 67 = Escape NoSymbol Escape
keycode 166 = Prior NoSymbol Prior
keycode 167 = Next NoSymbol Next
The first two line swap the F1 and ESC keys. The other ones configure as page-up and page-down the two keys near the arrows with unusual icons depicting a sheet with a folded corner and arrows pointing to the left and the right. To test the file I’ve used:
$ xmodmap ~/.Xmodmap
while on next login the file would have been read for me automatically.