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.


History


Special Stuff in My Installation


Details

Model

7854-RU2

Hardware

  • 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     http://ftp.de.debian.org/debian/ wheezy         main non-free contrib
deb-src http://ftp.de.debian.org/debian/ wheezy         main non-free contrib
deb     http://security.debian.org/      wheezy/updates main non-free contrib
deb-src http://security.debian.org/      wheezy/updates main non-free contrib

wlan

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

apt-get install firmware-iwlwifi

hibernate

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.

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/xfce-applications.menu. 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"
EndSection

[**] 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/powerbtn-acpi-support.sh 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:

GRUB_CMDLINE_LINUX_DEFAULT="quiet \
    pcie_aspm=force \
    i915.i915_enable_rc6=1 \
    i915.i915_enable_fbc=1 \
    i915.lvds_downclock=1"

And now run:

update-grub

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).

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-0.9.4.0
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);
        return;
    }
#endif

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 + 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;
    }
#endif
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.

Untested

  • 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

Content

Index

May 21st, 2018
Comments? Suggestions? Corrections? You can drop me a line.
zpentrabvagiktu@theiling.de
Schwerpunktpraxis
Datenschutz