Debian Wheezy on Lenovo Thinkpad L420

I installed Debian 7.0 (Wheezy) Linux on a Lenovo Thinkpad L420. I used the 32-bit version for x86.

Most important information first: it works very well. Don't be put off by a hanging installer, which might happen, because there's a firmware bug and detecting the WLAN hardware will cause the HW autodetect to hang in some versions of the installer.

I started to try to install wheezy in 2012/05 when it was 'testing' before the freeze. I hope the installer is fixed now (or the firmware). I did find an installation CD that worked, finally. If you did not, I guess you can kill the autodetect from another console and proceed somehow, installing the WLAN drivers later.

The summary is: after getting past the installer problems, this is working better with Linux than any laptop I had before. However, this is still not a 100% stable and predictably working installation. And to get some features to work, manual work is necessary.

One caveat not related to Linux: this Thinkpad has no ThinkLight. I did not notice this before ordering and I am really disappointed by this.

Another caveat: despite reports that the keyboard is good, I don't like the keyboard at all. It is less precise than the z60m keyboard (which was also not perfect) and from the very start, some key presses are dropped as if the electric contacts don't touch. This is really sad as the keyboard is what I use most.


Special Stuff in My Installation





  • SATA: Samsung 320TB 1 platter HD w/ 4096 byte sectors (7mm flat)
  • USB 0bdb:1911: Ericsson Business Mobile Networks BV WWAN card
  • USB 5986:03b4: Acer Camera
  • PCI: Realtek RTS5209 Card Reader
  • PCI: Realtek RTL8111/8168B Gigabit Ethernet
  • PCI: Intel Advanced-N 6205 WLAN
  • Intel HD Audio sound

Replaced Hardware

  • Swapped Samsung disk for 1TB Western Digital WD10JPVT

Working Out Of the Box

  • keyboard,
  • hard disk,
  • display, vga out, dual-head display (see below), 2d accel, 3d accel,
  • ethernet,
  • touchpad, trackpoint,
  • volume incr/decr/mute buttons (with strange behaviour, see below),
  • brightness incr/decr buttons (with strange behaviour, see below),
  • usb,
  • esata,
  • sound,
  • sd-card reader,
  • dvd writer,
  • suspend,
  • bluetooth (see below),
  • camera (tested with guvcview)

Fixed Issues

Where possible, the following tweaks can be installed by simply unpacking this TGZ file in the root directory of your laptop. No files will be overwritten by unpacking, and only the bug fixes will be active, but not optional features.

cd /
tar xzvpf /path/to/l420-all.tgz

In most of the sections, there is a TGZ file with only the files fixing that specific problem. Each file can be installed the same way as l420-all.tgz.

Where config files need additional editing or when using a patch is optional, or other manual work is required, this is marked with [**] in the following text.

apt non-free

[**] Make sure that /etc/apt/sources.list includes the non-free and contrib Debian repositories. My sources.list looks like this:

deb wheezy         main non-free contrib
deb-src wheezy         main non-free contrib
deb      wheezy/updates main non-free contrib
deb-src      wheezy/updates main non-free contrib


[**] I needed to install the Intel drivers.

apt-get install firmware-iwlwifi


Create a single line file /etc/pm/config.d/thinkpad_acpi with contents:

SUSPEND_MODULES="thinkpad_acpi iwlwifi psmouse"

This file is packed in this TGZ which you can simply unpack in the root directory (no files will be overwritten).

xrandr switching screen size does not update pager

I suspect that xfwm4 is to blame as setting the _NET_DESKTOP_GEOMETRY window hint is the window manager's responsibility, but it does not change when using xrandr to switch the display. The result is that the pager width does not adjust and the windows on the second screen are not shown on the pager. Setting the _NET_DESKTOP_GEOMETRY property with xprop makes the pager react immediately and readjust.

The problem arises for me mainly when plugging monitors. See the next section for details.

automatic second monitor switching

Manual setup using 'Settings|Display' from the XFCE main menu and using 'arandr' (you can apt-get install it) works very well.

But it seems like Debian still requires manual work when a monitor is connected to/disconnected from the VGA port. I.e., monitor hotplugging does not work. To switch on/off the second monitor automatically, I did the following:

Make directory /etc/screenlayout.

We need a script to check for connected monitors that sets up xrandr in the way we want it. The following script works for both Zaphod and Xinerama mode. Create /etc/screenlayout/switch-auto with contents:


if cat /etc/X11/xorg.conf | grep -v '#' | grep -q Zaphod
    ##### ZAPHOD MODE #####

    # This is invoked for each screen.  The right one (:0.1) will react.
    xrandr \
        --output VGA1  --auto \
        --output HDMI1 --auto \
        --output DP1   --auto

    ##### XINERAMA MODE #####

    if xrandr | grep connected | grep -v disconnected | grep -q VGA1
        xrandr \
            --output LVDS1 --auto --pos 0x0        --rotate normal --reflect normal \
            --output VGA1  --auto --right-of LVDS1 --rotate normal --reflect normal \
            --output HDMI1 --off \
            --output HDMI2 --off \
            --output HDMI3 --off \
            --output DP1   --off \
            --output DP2   --off \
            --output DP3   --off
        xrandr \
            --output LVDS1 --auto --pos 0x0        --rotate normal --reflect normal \
            --output HDMI1 --auto --right-of LVDS1 --rotate normal --reflect normal \
            --output VGA1  --off \
            --output HDMI2 --off \
            --output HDMI3 --off \
            --output DP1   --off \
            --output DP2   --off \
            --output DP3   --off



Make that file executable.

We need a script that updates the window manager hints so that the pager has the right dimensions after switching the resolution. Create /etc/screenlayout/updatexprop with contents:

#! /bin/sh
GEOM=$(expr "`xdpyinfo | grep dimension`" : '.* \([1-9][0-9]*x[1-9][0-9]*\).*')
GEOM_X=$(expr "$GEOM" : '\(.*\)x.*')
GEOM_Y=$(expr "$GEOM" : '.*x\(.*\)')

Make that file executable.

We need a script that can be run from an udev rule to invoke the screen switching script. Create /etc/screenlayout/switch-auto.hotplug with contents:

#! /bin/sh
# This is run from an udev rule.  It needs to find out which user is the X user and run switch-auto as
# that user in order to connect to the X server.

. /usr/share/acpi-support/power-funcs

for x in $d/X*; do
    if test "x$XAUTHORITY" != x
        sleep 2   # wait for monitor to settle
        for screen in 0 1
            export DISPLAY=":$displaynum.$screen"

Make that file executable.

Finally, we need an udev rule to invoke the switching script when a monitor plug event is encountered. Create /etc/udev/rules.d/40-display.rules with contents:

ACTION=="change", SUBSYSTEM=="drm", ENV{HOTPLUG}=="1", RUN+="/etc/screenlayout/switch-auto.hotplug"

That's it, the second monitor is switched automatically now.

All the files are packed in this TGZ which you can simply unpack in the root directory (no files will be overwritten).

display manager uses strange dual-head config

Somewhat related: if two screens are available when lightdm, the display manager I use, starts up, it will activate all of the screens and set them to 1024x768, regardless of real resolution. That's kinda wrong, I think. I want the laptop screen to be the only one that is on in this situation and I want it with the right resolution.

Create /etc/screenlayout/laptop-single with contents:

xrandr \
    --output LVDS1 --auto --pos 0x0 --rotate normal --reflect normal \
    --output VGA1  --off \
    --output HDMI1 --off \
    --output HDMI2 --off \
    --output HDMI3 --off \
    --output DP1   --off \
    --output DP2   --off \
    --output DP3   --off

[**] Edit /etc/lightdm/lightdm.conf and find the line about display-setup-script=... that is commented out. Replace it with:

display-setup-script = /etc/screenlayout/laptop-single

The above TGZ already contains the laptop-single file, but does not do the one-line editing of the lightdm config file.

xfce main menu editing

When trying to edit the main menu of XFCE, e.g. to add an item, the order of entries is mixed up. It seems the editor for the main menu is broken.

[**] The solution is to first edit it with the broken editor, and then fix it manually in ~/.config/menus/ You only need to remove the <layout> section, then the added items are there, and they are correctly sorted (by name).

power button

The power button generates an X event (IIRC, keycode 124) and can thus be used somehow. However, the XFCE power manager does not seem to bother much about that button, so essentially, it does not do what it is supposed to do.

I want the button to immediately power down my computer cleanly. I do not want X interfering, because the one time when I really need it is when X hangs for whatever reason. (E.g. a login screen that only appears on a monitor that is not connected anymore and jokes like this. Happens when going to sleep in a docking station and then waking up without one.)

To make it work the way I want it, I did two things: (1) disable the button in X, (2) convince ACPI scripts that they are responsible of handling the button despite running power manager in X.

To disable the button in X, put the following in your /etc/X11/xorg.conf, if you have one. Otherwise, create one. In this TGZ, I put the section in a file called /etc/X11/xorg-xinerama.conf, so it does not interfere with your system, and is not enabled by default:

Section "InputClass"
        Identifier "ThinkPad Power Button"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        MatchProduct "Power Button"
        Option "Ignore" "true"

[**] If this is the only thing in your xorg.conf, link the new file to activate it:

ln -s xorg-zaphod.conf /etc/X11/xorg.conf

Now open /etc/acpi/ and search for CheckPolicy. Disable the if by commenting it out. The corresponding piece of script should look like this:

# if CheckPolicy; then
#       exit 0
# fi

The power button should work now.

power saving

A few things can be tweaked for less power consumption and/or battery life. These ideas are from this site about the T420 . First of all, install sysfsutils.

Then create a file /etc/sysfs-l420.conf with the following contents:

devices/platform/smapi/BAT0/start_charge_thresh = 20
devices/platform/smapi/BAT0/stop_charge_thresh = 80

class/backlight/acpi_video0/brightness = 6

module/snd_hda_intel/parameters/power_save_controller = Y
module/snd_hda_intel/parameters/power_save = 2

devices/system/cpu/sched_mc_power_savings = 2
devices/system/cpu/sched_smt_power_savings = 2

The BAT lines will fail but maybe there's hope that tp_smapi will work one day, so I'll keep it in. And probably the _mc_ stuff will fail, too, but I don't understand the difference to the _smt_ stuff, so I'll keep it in, too.

This file is included in the TGZ files, but will not be activated by default, because I don't want to overwrite any files when the TGZ is unpacked.

[**] To activate, replace the initially empty config file with the new config file:

ln -sf sysfs-l420.conf /etc/sysfs.conf

[**] Next, enable a few tweaks of the i915 chipset that hopefully work on the L420 laptop, too. As root, edit /etc/default/grub. Change the GRUB_CMDLINE_LINUX_DEFAULT line to include a few extra options:

    pcie_aspm=force \
    i915.i915_enable_rc6=1 \
    i915.i915_enable_fbc=1 \

And now run:


suspend or hibernate + screen lock

xfce-session fails to activate screen lock on suspend. This is pretty bad. The power manager does it correctly (via the tray icon or when closing the lid), the Fn-F4 key does it correctly, but not the logout dialog of the session manager of XFCE. Version 4.9 received a patch to make it work, but 4.8.3 in Wheezy misses this feature. Backporting is not that trivial as a lot has changed in v4.9.

To hack this, I added a script to /etc/pm/sleep.d, which checks that an actual XFCE4 is running and that the option 'lock screen on suspend/hibernate' in the power manager settings is set to true (or unset, which also means true, because that's the default). This script does not interfere with other sessions (like gnome).

So to fix, create a file /etc/pm/sleep.d/40_xfce4-lock-screen with the following contents:

#! /bin/sh -x
# Hack for xfce4-session v4.8 to support screen lock on sleeping.
case "$1" in
        . /usr/share/acpi-support/power-funcs
        for x in $d/X*; do
            if test "x$XAUTHORITY" != x
                export DISPLAY=":$displaynum"
                if xprop -root _DT_SAVE_MODE | grep -q xfce4
                    CMD="xfconf-query -c xfce4-power-manager -p $KEY || echo true"
                    DOLOCK=`(su "$XUSER" -c "$CMD") 2>/dev/null`
                    if test "x$DOLOCK" = "xtrue"

Make that file executable.

The only caveat is that those suspend/hibernate commands that actually work correctly out of the box (like closing the lid, the power manager tray icon and the Fn-F4 key) will complain that the screen is already locked. This message is visible only very briefly and does not influence the rest of the system. I think that's ok.

This small helper script is included in this TGZ file.

bluetooth modem

Theoretically, I should be able to use my mobile phone to get an Internet connection. Now, you ask: why do you want that, your laptop has a WWAN card? Right. But maybe I'd like to swap it for an mSATA SSD card!

Connecting to the phone works great from XFCE using blueman. No problem there. When the modem connection is established, it says: "Bluetooth modem connections are now available in your NetworkManager". Unfortunately, they are not.

I found a web page solving the problem. It is necessary to patch and recompile network-manager, unfortunately.

The patch as given on the above page is not good for me as it removes the embedded WWAN modem from network-manager. My patch is thus different.

I am not completely sure about what the side effects of the patch are, because I don't fully understand what the code does, and I am too lazy to continue investigation. In the worst case, some other modem constellation may not work anymore. The code we're going to disable prevents network-manager from handling a modem, so that's the worst case: in some unwanted situation, network-manager may handle a modem where it shouldn't. For me, that's ok.

To fix, do the following as root (strictly, you only need to do the dpkg -i as root). Install the source of network manager:

cd /usr/src
apt-get source network-manager

Enter the directory, edit the file that prevents bluetooth from working:

cd network-manager-
vi src/nm-manager.c

Search for "bluetooth" (including the quotes). Enclose the if() in an #if 0...#endif block so the code looks like this:

#if 0
    if (driver && !strcmp (driver, "bluetooth")) {
        nm_log_info (LOGD_MB, "ignoring modem '%s' (no associated Bluetooth device)", ip_iface);

Recompile the package:

dpkg-buildpackage -b -uc -us

If dependencies are missing, you will be told so and should install the missing packages.

After compilation, install the patched package:

cd ..
dpkg -i network-manager_0.9.4.0-5_i386.deb

In this TGZ file, there is a patch for network-manager for your convenience, which extracts into /usr/src/patches.

Not Working/Buggy/Unusable

Zaphod mode

This section is for people who like Zaphod mode, i.e., two separate X screens :0.0 and :0.1 when two monitors are connected. Skip this if you like the default Xinerama mode.

I tried this for several days, but found it too unstable and unfortunately had to switch back to Xinerama mode. I cannot recommend it. I will keep the section here to explain how it can be activated. Maybe there will be a fix to the Intel driver one day so it may become useful again.

Be warned that this is operating the Intel driver in a mode that is officially experimental. I have had a few SIGSEGV myself.

As I said above, this is manual work. You have to write an xorg.conf file that you usually don't need nowadays as all the default settings of X11 are fine.

The config file only consists of the basic skeleton needed plus the Zaphod specific stuff. I still relies on X11 defaults, so it is only a small change compared to the internal default of X11.

I called the config file xorg-zaphod.conf so it does not interfere with the rest of the system, this means that if you unpack the TGZ, this config file is not automatically enabled, but you need to add a link.

Create the file /etc/X11/xorg-zaphod.conf with the following contents:

# xorg.conf for dual head with two separate screens

Section "InputClass"
        Identifier "ThinkPad Power Button"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        MatchProduct "Power Button"
        Option "Ignore" "true"

Section "Device"
        Identifier "device0"
        Driver     "intel"
        BusID      "PCI:0:2:0"
        Option     "AccelMethod"  "SNA"
        Option     "NoAccel"      "True"
        Option     "ZaphodHeads"  "LVDS1"
        Screen     0

Section "Device"
        Identifier "device1"
        Driver     "intel"
        BusID      "PCI:0:2:0"
        Option     "AccelMethod"  "SNA"
        Option     "NoAccel"      "True"
        Option     "ZaphodHeads"  "VGA1,HDMI1,DP1"
        Screen     1

Section "Screen"
        Identifier "screen0"
        Device     "device0"

Section "Monitor"
        Identifier "monitor1"
        Modeline   "1024x720"   59.50   1024 1072 1176 1328  720 723 733 748     -hsync +vsync
        Modeline   "1368x768"   85.25   1368 1440 1576 1784  768 771 781 798     -hsync +vsync
        Modeline   "1400x1050"  121.75  1400 1488 1632 1864  1050 1053 1057 1089 -hsync +vsync
        Modeline   "1680x1050"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
        Modeline   "1920x1080"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

Section "Screen"
        Identifier "screen1"
        Device     "device1"
        Monitor    "monitor1"

Section "ServerLayout"
        Identifier "default"
        Screen     "screen0" 0 0
        Screen     "screen1" Relative "screen0" 2000 1000

The 'Power Button' stuff is part of another patch, see above. If you don't want it, you should comment it out.

The 'SNA' stuff is the experimental part. Without this, Zaphod is not supported. With it, you may experience some crashes (SIGSEGV of the X server or a hang in the Intel driver producing error messages about overflowing event queues). What also fails with Zaphod is 'Xfce Display Settings'. I use 'arandr' anyway.

The additional Modelines (and the whole Monitor section) are to have more default modes if the second monitor has no EDID information. I encountered this a few times and wanted to use a 16:9 resolution. The lines were computed with the cvt utility.

The 'Relative' stuff for screen1 is to ensure that X11 will not move to another screen when hitting the edge with the mouse. This is realised by moving the second screen away from the first one in X11's screen topology. For me, hitting the edge means to switch workspaces, not screens.

As a side node related to Zaphod: arandr has the nice feature to display itself on one screen but controlling another. See its --randr-display option.

[**] To enable Zaphod mode, make a link:

ln -s xorg-zaphod.conf /etc/X11/xorg.conf

Now restart X11 (or lightdm or whatever you're using) and you should have Zaphod mode. The automatic resolution switching installed above should also work now.

If you use Zaphod mode, you probably know how to switch between screens. I use the totally manual approach. One way of doing it that way is to install xdotool. Then use:

xdotool mousemove --polar --screen 1 0 0
xdotool mousemove --polar --screen 0 0 0
Or write a script to switch automatically. I invoke this with a keyboard shortcut:
#! /bin/sh
eval $(xdotool getmouselocation --shell)
xdotool mousemove --polar --screen $[1-$SCREEN] 0 0

Zaphod + xfwm + wrap workspace

Since Zaphod mode is not stable, this section is classified as 'broken', too.

One thing that broke for me with Zaphod mode was xfwm's option 'Wrap workspaces when the pointer reaches the screen edge'. For some reason, the developers think that this option is not sensible in Zaphod mode. In my xorg.conf, I prevent X from warping the mouse between the two screens, so moving the mouse against an edge to switch the workspace does not interfere with this setup. Unfortunately, I had to patch xfwm to make it work. If you need it, here is what I did:

Do all the following as root. Install xfwm4 sources:

cd /usr/src
apt-get source xfwm4
Open xfwm4-4.8.3/src/events.c in an editor
vi xfwm4-4.8.3/src/events.c
Search for screens and add an #if 0...#endif around the if(), so that the code looks like this:
#if 0
    if (display_info->nb_screens > 1)
        /* Wrap workspace/wrap windows is disabled with multiscreen */
        return EVENT_FILTER_REMOVE;
Enter the directory and compile it:
cd xfwm4-4.8.3
dpkg-buildpackage -b -uc -us
You may need to satisfy the build requirements with a few apt-get install commands.

Then install your special version of xfwm4:

cd ..
dpkg -i xfwm4_4.8.3-1_i386.deb
Unfortunately, this needs to be done each time the package is updated by Debian.

Along with the xorg-zaphod.conf, patches for xfwm4.8 as included in Wheezy and for xfwm4.10 (currently the most recent) are packed in this TGZ file and will install in /usr/src/patches.

card reader (sometimes)

Sometimes the card reader does not generate events on insert/remove and thus does not work at all. No devices are generated in /dev, no udev event is send, and thus the media is not mounted.

suspend (sometimes)

Usually, suspend works.

However, sometimes, suspending does not work for an unknown reason. On one occasion, trying to suspend crashed with a kernel panic. Fortunately, up to now, the laptop always woke up after sleeping...

Sometimes when suspend does not work, and when I decide to reboot instead (which is reasonably fast), the machine will suspend during shutdown process. When waking up, shutdown is completed.

I have no idea what prevents suspend from working properly. It works in 90% of the cases. Shutting the lid feels a tad bit less likely to work.

advanced power management, battery control

The thinkpad_ec driver (tp_smapi) does not start. This means some advanced power and battery saving features cannot be used. Probably the L420 is simply not supported. The driver sometimes complains in the syslog with a few hundred lines of

... thinkpad_ec: thinkpad_ec_read_row: failed requesting row: (0x11:0x00)->0xfffffff0

For me, that's ok for now, the missing features are not functionally essential.

volume control (usable, but strange)

The volume control is strange sometimes, depending on whether the machine boots with volume muted or unmuted. If unmuted, all is fine. If muted, changing the volume automatically mutes(!) the volume, and muting will always unmute the volume. Note that the underlying volume is changed, but as a side effect, the volume is muted. So you can unmute and get the desired volume. Some of the logic is obviously reversed. I don't know how to fix this.

brightness control (usable, but strange)

Inconsistent behaviour: the brightness down Fn button adjusts the brightness in steps of 3 on each key press while the up button does in steps of 1. I.e., from max brightness to min brightness, it takes 5 key presses, while from min to max, it takes 15. The screen has 16 levels (0..15). Some people seem to have 3 steps for the brightness control in both directions, but I have this inconsistent behaviour.


  • pc-card
  • WWAN
  • finger print reader
  • display port connector
  • When in suspend, does the machine wake-up and go into hibernate when battery becomes critical? The laptop issues an event in this case, so it might work. But it's quite difficult to test and debug (you need a lot of patience), so I did not try.
  • Some people have more serious problems with L420 and Linux. They say updating to the most recent BIOS version (1.19 as of this writing) helps.

random software that worked

  • X
  • gnome3
  • xfce4.8
  • Knoppix 7.0.3



September 27th, 2012
Comments? Suggestions? Corrections? You can drop me a line.