Installing Ubuntu 11.04 (Natty Narwhal) on a ThinkPad X220

From ThinkWiki
Revision as of 16:35, 3 November 2013 by MarkStosberg (Talk | contribs) (accessories purchased a particular person are not of general interest.)
Jump to: navigation, search

I installed Ubuntu 11.04 (Natty Narwhal) on a ThinkPad X220, model 42902GW.

I have since upgraded to Ubuntu 11.10 (Oneiric Ocelot) and have updated some of the information below accordingly.

Netboot

As a source of network installation files I made use of another GNU/Linux computer on my home LAN which is connected to the Internet through a familiar ADSL-modem/gateway/router/caching nameserver/DHCP server (call it "the gateway") at address 172.19.3.1. The gateway's DHCP server issues leases in the range 172.19.3.2 to 172.19.3.100.

First I set up the "source" machine, in my case one which already also had Ubuntu 11.04 installed. It has address 172.19.3.7 (assigned to it by the gateway's DHCP server). For the X220 to boot from it the machine needs to run a DHCP server and a TFTP server. The DHCP server serves only this special purpose since, as I mentioned, the gateway is the network's main DHCP server. The source's DHCP server must be so configured that it doesn't conflict with the existing DHCP server.

Install the isc-dhcp-server package and edit /etc/dhcp/dhcpd.conf using the following as a model. I am not sure that every line is needed, but this worked for me.

ddns-update-style none;
option domain-name-servers 172.19.3.1;  # This is the address of my gateway
option routers 172.19.3.1;              # This is the address of my gateway
option subnet-mask 255.255.0.0;         # This is the netmask of my home network
default-lease-time 600;
max-lease-time 7200;
allow booting;
allow bootp;

subnet 172.19.3.0 netmask 255.255.255.0 {
  range 172.19.3.220 172.19.3.229;      # This is a range separate from the one used by the gateway and includes the address below
}

group {
  next-server 172.19.3.7;               # This is the address of the "source"
  host trawsfynydd {                    # 'trawsfynydd' is the name I chose for my X220
    hardware ethernet f0:de:f1:6b:22:bf; # This is the Ethernet address of the X220
    fixed-address 172.19.3.220;         # This is an address in the range as defined above
    filename "/pxelinux.0";
  }
}

Now install the tftpd-hpa package, download the network installation tarball and untar it into the location whence tftpd serves files.

$ cd /tmp
$ wget http://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/current/images/netboot/netboot.tar.gz
$ cd /var/lib/tftpboot
$ sudo tar zxf /tmp/netboot.tar.gz

Second set up the X220 for PXE (Pre-boot eXecution Environment).

  • Switch on the X220 and press F1. ThinkPad Setup starts.
  • Set Config | Network | Ethernet LAN Option ROM to "Enabled".
  • Select Startup | Boot; select "PCI LAN IBA GE Slot..." and use the [+] key to move it to the top of the boot priority order
  • Press F10 to save and exit.

Voilà, the X220 boots the Ubuntu installer.

Installation

I won't describe the Ubuntu installer. I'll just mention some little problems I had.

First, when it came time to resize the existing (ntfs) partition the partitioner asked what size I would like for "this partition". Did it mean the to-be-resized ntfs partition or the new ext4 partition?

Turns out it meant: the to-be-resized ntfs partition, so the suggested "max" selection was the opposite of what I wanted.

Second, when I selected (only) the "Ubuntu desktop" task the installation reported failure without explaining what had gone wrong.

I de-selected all tasks and the installation succeeded.

Third, after reboot the screen came up black.

I pressed CTRL-ALT-F1 to get the system console so I could log in.

After logging in I ran tasksel and installed "Ubuntu desktop" and this time no failure was reported.

Information

BIOS

Originally:

BIOS Version: 8DET46WW (1.16)

From Windows 7 I ran Lenovo ThinkVantage Tools to upgrade the BIOS. Now:

BIOS Version: 8DET51WW (1.21)

dmidecode

# dmidecode -s system-manufacturer
LENOVO
# dmidecode -s system-product-name
42902WG
# dmidecode -s system-version
ThinkPad X220

/proc/cpuinfo

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 42
model name	: Intel(R) Core(TM) i5-2540M CPU @ 2.60GHz
stepping	: 7
cpu MHz		: 800.000
cache size	: 3072 KB
physical id	: 0
siblings	: 4
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 x2apic popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid
bogomips	: 5182.27
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

lspci

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series Chipset Family MEI Controller #1 (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (rev 04)
00:1a.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1c.4 PCI bridge: Intel Corporation 6 Series Chipset Family PCI Express Root Port 5 (rev b4)
00:1d.0 USB Controller: Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation 6 Series Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series Chipset Family 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series Chipset Family SMBus Controller (rev 04)
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 (rev 34)
0d:00.0 System peripheral: Ricoh Co Ltd Device e823 (rev 04)

lsusb

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 006: ID 04f2:b217 Chicony Electronics Co., Ltd 
Bus 001 Device 005: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 001 Device 004: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Key table

This table was prepared before keys were remapped as discussed elsewhere on this page.

References:

Key combination Extra function symbol ACPI event
(acpi_listen)
Scan code
(showkey -s)
(hex)
Linux key code
(showkey -k)
Input event
(input-events)
... on input device(*) X KeyCode
(xev)
Keyboard Shortcuts name
📢⃥ (loudspeaker icon with stroke) (none) down: e0 20
up: e0 a0
113 KEY_MIN_INTERESTING (0x71) 3 121 XF86AudioMute
−📢 (minus sign, loudspeaker icon) (none) down: e0 2e
up: e0 ae
114 KEY_VOLUMEDOWN (0x72) 3 122 XF86AudioLowerVolume
📢+ (loudspeaker icon, plus sign) (none) down: e0 30
up: e0 b0
115 KEY_VOLUMEUP (0x73) 3 123 XF86AudioRaiseVolume
🎤⃥ (microphone icon with stroke) ibm/hotkey HKEY 00000080 0000101b (none) 240 (rop) KEY_UNKNOWN (0xf0) 6 248 "∅" (sic)
ThinkVantage ibm/hotkey HKEY 00000080 00001018 down: e0 1f e0 9f 148 (rop) KEY_PROG1 (0x94) 6 156 XF86Launch1
Fn (none) up: e0 63 e0 e3 143 KEY_WAKEUP (0x8f) 3 151 XF86WakeUp
Fn-F1 ibm/hotkey HKEY 00000080 00001001 (none) 466 (rop) KEY_FN_F1 (0x1d2) 6 (none) (none)
Fn-F2 🔒 (padlock symbol) ibm/hotkey HKEY 00000080 00001002 down: e0 12 e0 92 152 (rop) KEY_SCREENLOCK (0x98) 6 160 XF86ScreenSaver
Fn-F3 🔋 (battery symbol) ibm/hotkey HKEY 00000080 00001003 down: e0 71 e0 f1 236 (rop) KEY_BATTERY (0xec) 6 244 XF86Battery
Fn-F4 ibm/hotkey HKEY 00000080 00001004 down: e0 5f e0 df
(but sometimes nothing)
142 (rop) KEY_SLEEP (0x8e) 6 150 XF86Sleep
Fn-F5 ⸨💻⸩ (radiating computer symbol) ibm/hotkey HKEY 00000080 00001005 down: e0 73 e0 f3 238 (rop) KEY_WLAN (0xee) 6 246 XF86WLAN
Fn-F6 (camera, headset) ibm/hotkey HKEY 00000080 00001006 down: e0 3b e0 bb 212 (rop) KEY_CAMERA (0xd4) 6 220 XF86WebCam
Fn-F7 💻⎚ (computer symbol, screen symbol) ibm/hotkey HKEY 00000080 00001007 down: e0 56 e0 d6 227 (rop) KEY_SWITCHVIDEOMODE (0xe3) 6 235 XF86Display
Fn-F8 (trackpoint symbol, vertical bar, trackpad symbol) ibm/hotkey HKEY 00000080 00001008 down: e0 74 e0 f4 191 (rop) KEY_F21 (0xbf) 6 199 XF86TouchpadToggle
Fn-F9 ibm/hotkey HKEY 00000080 00001009 down: 6f ef 194 (rop) KEY_F24 (0xc2) 6 202 "Ê" (sic)
Fn-F10 (none) (none) (none) (none) (none)
Fn-F11 ibm/hotkey HKEY 00000080 0000100b (none) 476 (rop) KEY_FN_F11 (0x1dc) 6 (none) (none)
Fn-F12 💻 ▶❍ (computer symbol, right arrowhead, diskpack symbol) ibm/hotkey HKEY 00000080 0000100c down: e0 25 e0 a5
(but sometimes nothing)
205 (rop) KEY_SUSPEND (0xcd) 6 213 XF86Suspend
Fn-Home ☀▴ ibm/hotkey HKEY 00000080 00001010 and video LCD0 00000086 00000000 down: e0 54 e0 d4 e0 54 e0 d4 225 (double) (rop) KEY_BRIGHTNESSUP (0xe1) 4, 6 233 XF86MonBrightnessUp
Fn-End ☀▾ ibm/hotkey HKEY 00000080 00001011 and video LCD0 00000087 00000000 down: e0 4c e0 cc e0 4c e0 cc 224 (double) (rop) KEY_BRIGHTNESSDOWN (0xe0) 4, 6 232 XF86MonBrightnessDown
Fn-PgUp (illuminating overhead lamp symbol) (none) (none) (none) (none) (none) (none) (none)
Fn-Space [🔍+] (screen with magnifying glass symbol and plus sign, i.e., "zoom" symbol) ibm/hotkey HKEY 00000080 00001014 (none) 372 (rop) KEY_ZOOM (0x174) 6 (none) (none)
Fn- ⏭ (barred right arrowhead, i.e., "next" symbol) (none) down: e0 19
up: e0 99
163 KEY_NEXTSONG (0xa3) 3 171 XF86AudioNext
Fn- ⏯ (right arrowhead, double bar, i.e., "play/pause" symbol) (none) down: e0 22
up: e0 a2
164 KEY_PLAYPAUSE (0xa4) 3 172 XF86AudioPlay
Fn- ⏮ (barred left arrowhead, i.e., "prev" symbol) (none) down: e0 10
up: e0 90
165 KEY_PREVIOUSSONG (0xa5) 3 173 XF86AudioPrev
Fn- ∎ ("stop play" symbol) (none) down: e0 24
up: e0 a4
166 KEY_STOPCD (0xa6) 3 174 XF86AudioStop
◂ ⎗ (left arrowhead, page icon) (none) down: e0 6a
up: e0 ea
158 KEY_BACK (0x9e) 3 166 XF86Back
⎘ ▸ (page icon, right arrowhead) (none) down: e0 69
up: e0 e9
159 KEY_FORWARD (0x9f) 3 167 XF86Forward

In the Linux key code column, "rop" means "release on press", i.e., the release event is generated at the same time as the press event.

The button on the UltraBase doesn't seem to generate any events visible to userspace.

Input device numbers and types as reported by lsinput:

(*) /dev/input/eventn
n name
0 "Lid Switch"
1 "Sleep Button"
2 "Power Button"
3 "AT Translated Set @ keyboard"
4 "Video Bus"
5 "Integrated Camera"
6 "ThinkPad Extra Buttons"
7 "SynPS/2 Synaptics TouchPad"
8 "TPPS/2 IBM TrackPoint"

Hotkey mask when the above table was compiled:

$ cat /sys/devices/platform/thinkpad_acpi/hotkey_mask
0x078dffff
$ cat /sys/devices/platform/thinkpad_acpi/hotkey_all_mask
0x07ffffff
$ cat /sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask
0x078dffff
$ cat /sys/devices/platform/thinkpad_acpi/hotkey_report_mode
1

Configuration and solved problems

Fingerprint reader

See how to enable the integrated fingerprint reader with fprint.

Fix for hotkey shortcomings

(Updated November 2011 for Oneiric.)

By default the "zoom" (Fn-Space) and "microphone-mute" (button next to the ThinkVantage button) hotkeys do nothing.

Zoom: The thinkpad-acpi module, kernel and udev map the zoom key's ACPI event (ibm/hotkey HKEY 00000080 00001014) to input event KEY_ZOOM whose numerical value, 372, is greater than 255, the highest key-event code that X can handle.

Micmute: The thinkpad-acpi module and kernel generate an ACPI event (ibm/hotkey HKEY 00000080 0000101b) for the microphone mute button but in releases earlier than precise this is not mapped to anything; in precise it is mapped to 256 which is also greater than 255, the highest that X can handle. Bug reported here.

The fault lies with X which can't handle key codes above 255. But as discussed, e.g., here, it may be a long time before this gets fixed in X.

There is a fairly easy workaround. Install version 175 or later of the udev package and do the following.

# sudo su
# mkdir /etc/udev/keymaps
# cp /lib/udev/keymaps/module-lenovo /etc/udev/keymaps

Now edit /etc/udev/keymaps/module-lenovo so that 0x13 and 0x1A get mapped to search and prog2, respectively (instead of zoom and micmute, respectively).

Then in System Settings | Keyboard | Shortcuts assign a behavior to the XF86Search event, the X event corresponding to search. This behavior will be invoked by Fn-Space.

There is no built-in function for muting the microphone but it is straightforward to concoct one using amixer. In Keyboard | Shortcuts select Custom Shortcuts and press + to create a new shortcut named "Microphone mute" whose command-content is the following.

sh -c "if amixer get Capture,0 | grep -q '\[on\]' ; then amixer -q set Capture,0 nocap ; else amixer -q set Capture,0 cap; fi"

Assign this to XF86Launch2 which is the X event corresponding to input event prog2. This behavior will be invoked by the microphone-mute key.

[Added June 2013:] This will supposedly be fixed for Ubuntu 13.10 (Saucy). The microphone-mute ACPI event will be mapped to f20 instead of prog2 but making use of this will require patches to other packages: https://code.launchpad.net/~jm-leddy/

Fix for the known no-system-beep problem

As I described in more detail earlier:

  • Create .xprofile containing
pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg
  • Run gconf-editor and at desktop | gnome | peripherals | keyboard change the value of bell_mode from off to on.
  • If the default bell volume of 50 (percent) is not loud enough, add a line like the following to ~/.bashrc.
xset b 100
  • To cause terminal bells to ring also in non-X terminals (e.g., the console terminal), comment out the blacklist pcspkr line in /etc/modprobe.d/blacklist.conf.

Fix for "[drm:i915_hangcheck_ring_idle] *ERROR* Hangcheck timer elapsed... blt ring idle..." problem

To fix this known problem upgrade the kernel: install the linux-image-2.6.38-11-generic package and reboot.

tp-smapi loading

First, it is as usual necessary to add

tp-smapi

to /etc/modules so that modoprobe will attempt to load the module at boot time.

hdaps

Having loaded hdaps do:

sudo add-apt-repository ppa:linrunner/thinkpad-extras
sudo apt-get update
sudo apt-get install hdaps-utils
hdaps-gl

Result:

Tilted ThinkPad X220 running hdaps-gl

Miscellaneous configuration

  • Having installed bare Ubuntu I had to run tasksel and select at least "Ubuntu Desktop".
  • In order to allow NetworkManager to manage eth0 I had to comment out the "eth0" stanza in /etc/network/interfaces
  • I used System Settings | Ubuntu Software Center to install ccsm ("Advanced Desktop Effects Settings") so I could enable Wobbly Windows and so I can initiate window resize with Alt+Button3 which is easier than the default Alt-Button2 (i.e., Alt-scrollwheelbutton).
  • Add PPAs to apt sources list for additional indicators

Unity automaximizes

To disable this (annoying) behavior, run gconf-editor and set apps|compiz-1|plugins|grid|screen0|options|top_edge_action to 0 (originally 10).

Ex-problems

Suspend causes kernel panic

"Suspend-to-RAM and brightness control of the display work with kernel >= 3.0-rc6" according to this fellow.

Since I upgraded to kernel 2.6.38-11-generic I haven't had any kernel panics on suspend.

TPM can't be used

To try it out, install tpm-tools.

When I first tried it, the tpm_version program failed with "Communication failure".

But now it prints this:

  TPM 1.2 Version Info:
  Chip Version:        1.2.8.32
  Spec Level:          2
  Errata Revision:     3
  TPM Vendor ID:       STM 
  TPM Version:         01010000
  Manufacturer Info:   53544d20

Presumably the new kernel fixed this.

memtest86+ didn't work

Upgrading to the oneiric version, v4.20, fixed this.

Multiple monitors

Configuring an extended desktop over two monitors led to malfunction. Side-by-side worked, one above the other did not.

In natty the solution was just to avoid the layouts that caused the malfunction.

The problems appear to have been completely solved in Ubuntu 11.10 (Oneiric Ocelot).

Bluetooth-related crashes

Switching bluetooth on or off either using the indicator or Fn-F5 sometimes crashed the machine.

I haven't seen this problem in Ubuntu 10.10 (Oneiric Ocelot).

tp-smapi loading problem

The distributed tp-smapi and hdaps modules didn't load on my X220 and thinkpad-acpi reported the EC firmware number as "unknown".

The BIOS setup program reports this information about the BIOS:

  • Model 42902WG
  • UEFI BIOS 8DET46WW (1.16) 2011-05-18
  • Embedded Controller 8DHT23WW (1.07)

This problem was fixed in tp-smapi version 0.41-1. As of 7 August 2011 tp-smapi-dkms is available in Debian unstable (Ubuntu uses Debian tp-smapi packages with no changes) and this is the version in Ubuntu 11.10 (Oneiric Ocelot).

Output from dmesg after modprobeing thinkpad-ec, tp-smapi and hdaps:

[  714.842090] thinkpad_ec: thinkpad_ec 0.41 loaded.
[  721.983409] tp_smapi 0.41 loading...
[  721.984742] tp_smapi successfully loaded (smapi_port=0xb2).
[  729.462533] hdaps: LENOVO ThinkPad X220 detected, setting orientation 4
[  729.462894] hdaps: initial mode latch is 0x05
[  729.463022] hdaps: setting ec_rate=250, filter_order=2
[  729.463242] hdaps: device successfully initialized.
[  729.463799] input: ThinkPad HDAPS joystick emulation as /devices/virtual/input/input15
[  729.464101] input: ThinkPad HDAPS accelerometer data as /devices/virtual/input/input16
[  729.464342] hdaps: driver successfully loaded.

Modinfo:

$ modinfo tp-smapi
filename:       /lib/modules/2.6.38-11-generic/updates/dkms/tp_smapi.ko
license:        GPL
version:        0.41
description:    ThinkPad SMAPI Support
author:         Shem Multinymous
srcversion:     B6841670771B2FF5222BFFD
depends:        thinkpad_ec
vermagic:       2.6.38-11-generic SMP mod_unload modversions 
parm:           debug:Debug level (0=off, 1=on) (int)

Remaining problems

Indicator lamp on microphone mute key doesn't work

The problem has been discussed, e.g., here.

Comparison with a Ubuntu 10.10 user's experience

  • (improvements)
    • I didn't have to do anything special to have the thinkpad-acpi module loaded or use special keys
    • The mute-microphone button can be made to work as described above
    • Both left and right microphones are seen
    • I have no difficulties with the fans
    • I have no difficulties with SD cards
    • The "Hangcheck timer elapsed" problem has been fixed in a new kernel version, as described above

Things to remember

To get Google Earth to work you have to do

sudo apt-get install libgl1-mesa-glx:i386