Debian GNU/Linux on the Thinkpad W510

Created on: May 29, 2010
Last modified on: Apr 13, 2013
© Numerical analysis team

This page offers some guidelines to install Debian GNU/Linux on a Lenovo Thinkpad W510. If you would like to share advice or pinpoint mistakes, send me an email.

Configuration

Hardware components Status under linux Notes
Intel Core i7 Q820 (1.73GHz–2.9GHz) Works
Nvidia Quadro FX 880M
Works The nv driver works out of the box. NVIDIA driver needed to talk to a data projector.
15.6'' FHD (1920×1080) LED Screen Works Native resolution works out of the box.  Tweak in the xorg.conf file to change the brightness.
320GB IDE (7,200rpm) SATA Hard Drive Works
24× MATSHITA DVD+-RW Drive Works
ACPI Works Memory and disk suspend work.
Intel Corporation 82577LM Gigabit Network Connection (rev 06)
Works module e1000e (included in the 2.6 kernel).
Intel Corporation Centrino Advanced-N 6200 (rev 35)
Works Driver iwlagn included in recent kernels.
Qualcomm Gobi 2000
Works
Firmware required.
Intel Corporation 5 Series/3400 Series Chipset High Definition Audio
Works (including recording) It uses a Connexant CX20585  codec.
Bluetooth Card Works
USB 2.0 and 3.0
Works USB 3.0 requires the xhci-hcd module and special care to suspend
Lenovo Integrated Webcam [R5U877]
Works
Use module uvcvideo (and the application guvcview to capture images)
SDHC-card reader Works

Upek Biometric Touchchip/Touchstrip Fingerprint Sensor
Detected

Basic installation

Before going any further we advise you to burn Lenovo rescue and recovery disks (you will need 18 CDs for that!).  That way you can restore your system in its factory state if needed and you can delete the Lenovo_Recovery partition (you will have to if you follow these notes).

This laptop came with windows 7.  Windows 7 possesses a disk partitioner that can resize its partition but not by much.  Since I will seldom use windows, 50 Gib is more than enough.  So I used a GParted Live CD to shrink Windows 7.  Have a cup of coffee, this takes a long time.  Then reboot Windows 7.  Il will execute  "chkdsk c:", reboot and seemingly be happy with the changes.  You may also want to check that the "ThinkVantage" button works on startup.  If you have troubles, you may want to follow this advice.  In any case, it is a good idea to burn a windows 7 system repair CD.

The testing version of Debian combines enough stability for a desktop use (actually, I never got any serious problem) and recent software. So the weekly built images of the Debian testing Installer were used to set up Debian.  You must select the amd64 architecture (debian-testing-amd64-CD-1.iso is enough to install, you can get other packages from the web).

The installer does not recognise the ethernet card, an Intel 82577LM, and the WIFI requires the firmware iwlwifi-6000-1.ucode and iwlwifi-6000-2.ucode.  So I installed the machine without the network.

In order for the Rescue and Recovery 4 tools to keep working (they are on the first partition labeled System_DRV), I was careful not to install GRUB in the MBR.  Instead I created a primary partition for / (erasing the Lenovo_Recovery primary partition to be able to create logical partitions) and  installed GRUB in its boot sector. Set the bootable flag on this partition (either during the partition of the disk or later with GParted).  For more information see the section "Newer versions of Rescue and Recovery" of Rescue and Recovery.

After reboot, put the package firmware-iwlwifi on a USB disk and install it by hand (dpkg -i firmware-iwlwifi_0.24_all.deb).  Now the ethernet and WIFI cards should be recognised.  Since network-manager is not installed, add to /etc/network/interfaces (using the program editor) the line iface eth0 inet dhcp (that you will remove later) and issue ifup eth0.  You should now be connected.  Also edit /etc/apt/sources.list to add the line deb http://ftp.fr.debian.org/debian/ testing main non-free contrib and issue aptitude update (comment the cdrom line).  You can now complete your installation.

Nvidia Quadro FX 880M graphic card

You have two options for the nvidia card.

To enable twinview — e.g. in clone mode if you also likie to see your presentation on your laptop screen — you can use nvidia-settings (only with the nvidia driver, this tool occasionally has problems) or xrandr (works with both drivers) to select dynamically which mode you want.

To switch the external monitor/projector on, use:

xrandr --output $LVDS --auto --output $VGA --auto --same-as $LVDS
where $LVDS and $VGA are the name of the flat pannel and the external projector as returned by xrandr -q.   This leaves the laptop in its native resolution (1920×1200) and set the data projectorn output to the top left portion of the screen of dimensions 1024×768. To display the presentation fullscreen on the data projector (as opposed to the laptop screen), I use a small xephyr script to start a Xephyr window and run evince in fullscreen mode in it (I have configured my window manager so that the Xephyr window does not have any decoration so its top left corner is at position (0,0)). The interest of this is that you can move the mouse outside the presentation window to, say, start applications, consult notes,... (without people seeing what you do).

To switch off the external screen, use:
xrandr --output $VGA --off

I actually use a small script, presentation, to perform these tasks, plus avoiding that the screensaver is lanched in the middle of a talk.

I avise you upgrade to gdm3 as it fixes a timeout problem of gdm with the nvidia driver.  If you do that, it is no longer necessary to tell X to use 110 dpi, the X server computes it to 144×144 (without he need for the DisplaySize parameter). The above does not seem to work with the nouveau driver.  An alternative method is to put xrandr --dpi 144 at the beginning of your ~/.xsesion file.  To check your current dpi, run xdpyinfo | grep resolution.  BTW ignore the people who tell you 1920 × 1080 will make everyting too small.  I personally love the sharp and fine details — and you can always make your font larger anyway (and many applications allow you to zoom in if so you wish).  You should be aware gdm3 enables some accessibility settings (the AccessX bit in particular) that leak into the user session.  In particular, "slow keys" are enabled you press shift for about 10 seconds or by a timer.  To disable it (until gdm3 is fixed), install the package xkbset and add to your ~/.xsession (or in any script that runs when you log in) the command:

xkbset -accessx

It is recommended to use the device /dev/input/mouse1 instead of /dev/psaux for the synaptics driver.

I recommend you try the crystalcursors package.  After installing it, run update-alternatives --config x-cursor-theme and choose, for example, /etc/X11/cursors/crystalblue_classic.theme. The cursors are nice looking and big enough for the WUXGA resolution.

Keyboard & audio buttons

I have a french keyboard. However, for programming or for LaTeX math typesetting dead keys are not convenient at all. On the other hand, for French texts, accented letters and guillemots ('«' and '»') are a must! To have both together, I have written a .xmodmap file which, by default, makes all accents non-dead and combined with AltGr or AltGr+Shift enable the dead one. Guillemots '«' and '»' are given by AltGr+< and AltGr+> respectively. These modifications are activated at login time by the following lines in ~/.xsession (you will notice that I use .xmodmap_$HOSTNAME instead of .xmodmap; this is because I synchronize my files between several machines at different locations — also plays the role of a backup — with different keyboard layouts):

XMODMAP=`which xmodmap`
XMODMAP_FILE=$HOME/.xmodmap_$HOSTNAME
if [ -x "$XMODMAP" ] && [ -f "$XMODMAP_FILE" ]; then
$XMODMAP $XMODMAP_FILE
fi

As I use fluxbox, I only needed to put

None XF86AudioLowerVolume :ExecCommand amixer -q set Master 2- unmute
None XF86AudioRaiseVolume :ExecCommand amixer -q set Master 2+ unmute
None XF86AudioMute :ExecCommand amixer -q set Master toggle

in ~/.fluxbox/keys for the buttons to actually perform their function. For other window managers, see e.g. here.  Beware that some packages like pulseaudio will grab these buttons (they will not even appear in xev!).

Play DVD videos

Before playing videos on Linux, you must start one on windows to set the region.  If you do not, you will have errors like libdvdread: Invalid title IFO (VTS_05_0.IFO). Remember that many DVD use CSS.  To play them, you need to install libdvdcss (beware that this might be illegal depending on your country).

Bluetooth

You obviously need to compile your kernel with bluetooth support. The device is detected and the modules are loaded. To use it, install the bluez stack: aptitude install bluez-pin bluez-utils bluez-hcidump. To discover blutooth devices (you need set your devices to be discovered — for example on the mouse you push a "connect" button):
hcitool scan
It will print something like
Scanning ...
        00:0C:55:19:D1:03       Targus Bluetooth Mini Mouse
Then, as root, issue
hidd --server
hidd --connect 00:0C:55:19:D1:03
That's all — you can play with your mouse now! If you do not remember which devices you connected, issue
hidd --show
The output will look like:
00:0C:55:19:D1:03 Bluetooth HID Boot Protocol Device [0461:4b01] connected [boot-protocol]

With the latest version of gnome-bluetooth, users do not have access to /dev/rfkill which prenvents bluetooth-applet to start.  A workaround consists in allowing the bluetooth group to have access to it (and put authorized users in that group) by adding

# Get access to /dev/rfkill for group 'bluetooth'
# See https://bugzilla.redhat.com/show_bug.cgi?id=514798
KERNEL=="rfkill", ENV{ACL_MANAGE}="1", GROUP="bluetooth", MODE="0664"

to, say, /etc/udev/rules.d/z99-local.rules.

ACPI (mostly suspend)

ACPI is woking fine.  Install acpi-support (but not vbetool, it is incompatible with the Nvidia GPU) and the xfce4-power-manager applet (which will set the policy while you are logged in).  For Gnome, you have gnome-power-manager.

You do not need the apmd package (you can remove it if installed).  Also hal is being phased out.  Since it will interfere with pm-utils during suspend, you should remove it.  Also remove powersaved (it no longer exists).

Suspend to RAM (often simply called "suspend") and suspend to disk (aka "hibernate") work.  For kernels 3.2 and later, there should nothing to do and form kernel ≥ 3.8.0, the scripts below will make suspend fail.

Unfortunately, for kernels < 3.2, suspend will not occur without removing the attached devices.  For that, create a file with executable permissions, say /etc/pm/sleep.d/20_custom-ehci_hcd, containing:
#!/bin/sh
# File: "/etc/pm/sleep.d/20_custom-ehci_hcd".

DEVICES="0000:00:1a.0 0000:00:1d.0"
case "${1}" in
hibernate|suspend)
# Unbind ehci_hcd for all devices
for d in $DEVICES; do
echo -n "$d" | tee /sys/bus/pci/drivers/ehci_hcd/unbind
done
;;
resume|thaw)
# Bind ehci_hcd for all devices
for d in $DEVICES; do
echo -n "$d" | tee /sys/bus/pci/drivers/ehci_hcd/bind
done
;;
esac
The list of devices can be found by issuing ls /sys/bus/pci/drivers/ehci_hcd/.  For kernels < 2.6.37, the USB 3.0 xhci_hcd module must also be unloaded.   Create a file, say /etc/pm/config.d/usb3-suspend-workaround, containing:
#File: "/etc/pm/config.d/usb3-suspend-workaround".
SUSPEND_MODULES="xhci xhci_hcd thinkpad_acpi"

There is an issue with suspend and multithreading.  With kernel 2.6.35.4, resume fails once every 4 or 5 times; this seems to be solved with kernels > 2.6.35.7.

Hard disk

The hard disk Active Protection System (HDAPS) requires some software to work. Install the package s hdapsd and tp-smapi-dkms.  I also lowered the sensitivity by setting SENSITIVITY=37 in /etc/default/hdapsd.  I also set OPTIONS="--adaptive" in the same file.

Under aggressive power management, the disk heads can park too often which reduces the disk life expectancy.  To see whether you are affected by the problem, install smartmontools and issue (as root)

smartctl -a /dev/sda

To get your average per hour hard disk load cycling, divide Load_Cycle_Count by Power_On_Hours.  My disk is a HITACHI and, according to this page, one has to use

hdparm -B 254 /dev/sda

This fix is in the package acpi-support (see bug #448673).  I changed 254 to 253 in /etc/hdparm.conf  and /etc/acpi/start.d/90-hdparm.sh (symlinked as /etc/acpi/ac.d/90-hdparm.sh, /etc/acpi/battery.d/90-hdparm.sh/etc/acpi/resume.d/90-hdparm.sh is obsolete for acpi-support ≥ 0.122-2) and /etc/laptop-mode/laptop-mode.conf as with the former value, some strange noise was sometimes heard from the disk led (!).  You can check the leval was set correctly with hdparm -I /dev/sda|grep 'Advanced power management level:'. Unfortunately, these settings are not preserved when waking from suspend or hibernation.  To do so, create a file /etc/pm/sleep.d/40-hdparm that contains

#!/bin/bash

case $1 in
    hibernate|suspend)
        ;;
    resume|thaw)
    /etc/init.d/hdparm restart
        ;;
    *)
        ;;
esac

See also http://www.seagate.com/docs/pdf/datasheet/disc/ds_momentus_7200_2.pdf.

Qualcomm Gobi 2000

For the the Qualcomm Gobi 2000 WWAN modem to work, we will use gobi_loader.  First put in /lib/firmware/gobi the following 3 firmwares:
amss.mbn   # md5sum: 84d002b0ef003cde6c95826bfbf067fe
apps.mbn # md5sum: d7496085f1af3d1bfdf0fa60c3222766
UQCN.mbn # md5sum: c3d6fd93ae2e52775ef9cd8fccbc20be
An easy way to get them is to mount the windows 7 partition and seek them on it.  The md5sum of these files are given on the thinkwiki page (there are several UQCN files).  In order for godi_loader to access the device, it must be recognized by the qcserial kernel module.  Download the patch for your kernel — in my case 2.6.34 — recompile and resinstall it.  With 2.6.35.4 and later, no patch is needed anymore.  The Debian package gobi-loader contains the above card (lsusb reports 05c6:9204 before the modem is activated, 05c6:9205 after) in the udev rules  (/lib/udev/rules.d/60-gobi-loader.rules) so you can use it as is.

I have been able to receive and read SMS with a GSM (I have not tried a broadband one) SIM card using the gammu library (present in Debian).  To access the phone, you need to write a file ~/.gammurc containing

[gammu]
device = /dev/gobi
connection = at
name=Qualcomm
The /dev/gobi is a symlink to the real device which may change between kernels.  It is created by the following udev rule (in my case set in /etc/udev/rules.d/z99-local.rules):
SUBSYSTEMS=="usb", DRIVERS=="qcserial", KERNELS=="2-1.4:1.2", SYMLINK+="gobi"

To establish a broadband connection with Network-Manager, do not forget to install modemmanager.

SDHC-card reader

You must compile your kernel with MMC with “Secure Digital Host Controller Interface support” in the “Device Drivers” section.  The memory sticks reader does not seem to be detected however.  The devices created for SD cards are typically /dev/mmcblk0p1.

Fingerprint reader

The reader indentifies as 147e:2016 on the USB bus (run lsusb).  Install the packages  fprint-demo and libpam-fprint.  To authentify through the reader, read /usr/share/doc/libpam-fprint/README.Debian.  You can also read the following generic instructions.  I have checked that enrolling fingers works.  However, biometrical authentication is work in progress.

There also exists a proprietary driver (libbsapi.so) from UPEK.  Fingerprint GUI will prompt you to install this driver; jus follow the step by step instructions. You can use fingerprint-gui to enroll your fingers (they will be recorded to /var/lib/fingerprint-gui/username/). I can verify my fingerprints with the same tool. There is a problem with authenticating though.

Saving power

PowerTOP (package powertop; see also the web site) is a tool that shows you software component(s) that make your laptop use more power than necessary while it is idle. A kernel ≥ 2.6.21 compiled with 

As reported by powertop, CONFIG_HPET is important because "without HPET support the kernel needs to wake up every 20 miliseconds for some housekeeping tasks".

Increase battery lifetime

Thinkpads have the possibility to control when the battery is charged.  This is done through the proprietary SMAPI BIOS which can be accessed through the tp_smapi kernel module.  For Debian, install the tp-smapi-dkms package.  This page has instructions on how to control when the battery charge takes place.

Network Manager

The later version of NetworkManager require to know the root password to access new wireless network.  In order to have a popup asking for the root password, you must make sure your graphical environment was started using ConsoleKit (this is the case if you use GDM or KDM; otherwise, put exec ck-launch-session $HOME/.xstart in your ~/.xsession and put your commands in ~/.xstart) and that you run a PolicyKit authentication agent such as /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1.  Without these, a message Failed to add new connection: (32) Insufficient privileges. will  be printed in the console.

Alternatively, to give permission to add new networks to the users in the netdev group (say), create a file /etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla with content

[nm-applet]
Identity=unix-group:netdev
Action=org.freedesktop.NetworkManager.*
ResultAny=yes
ResultInactive=no
ResultActive=yes

Useful Software

Here are a few links to Debian packages that I use. I list them here with the hope you may make an interesting discovery or that they may ease your life! Enjoy!

Links & Files

 
Linux On Laptops TuxMobil - Linux on Laptops Iceweasel Get Firefox system