Tech > LenovoT500Suspend

Lenovo T500 Suspend


This document contains notes on using suspend/hibernate on the Lenovo T500 with Debian 6.0 (Squeeze). Note that the behaviour of suspend varies between Debian versions.

It is well worth reading the documentation under /usr/share/doc/pm-utils/, /usr/share/doc/hibernate/ and the man pages from pm-suspend.

To debug the pm-utils scripts, set PM_DEBUG to "true" as follows:

  $ echo 'PM_DEBUG="true"' | sudo tee /etc/pm/config.d/10Debug

See also the Linux Kernel document, Debugging hibernation and suspend.

Warning: When attempts to sleep or suspend the system fail, it can corrupt file systems. Crashes can be quite severe. Make sure you have adequate backups before attempting these operations. One of my LVM partitions was corrupted beyond repair and had to be recovered from a backup.

Video Quirks

All models of T500, other than 2242CTO will default to using the default quirks defined in /usr/share/hal/fdi/information/10freedesktop/99-video-quirk-default.fdi which causes the system to freeze on thaw. It is necessary to modify /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-lenovo.fdi

Find out the model number of your T500 with the following command:

  $ lshal | grep system.hardware.product

In this example, the T500 has a model number of 2081CTO.

Add an entry in /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-lenovo.fdi below the existing entry for the T500 2242CTO model listed.

  <!-- T500 2081CTO -->
  <match key="system.hardware.product" string ="2081CTO">
    <match key="system.hardware.version" string = "ThinkPad T500">
    <merge key="power_management.quirk.vbe_post" type="bool">true</merge>
    <merge key="power_management.quirk.vbestate_restore" type="bool">true</merge>

Alternatively, modify the existing T500 entry...

  <!-- T500 -->
  <match key="system.hardware.product" string_outof ="2242CTO;2081CTO">
    <match key="system.hardware.version" string = "ThinkPad T500">
    <merge key="power_management.quirk.vbe_post" type="bool">true</merge>
    <merge key="power_management.quirk.vbestate_restore" type="bool">true</merge>

Restart hal and check what quirks are listed. There should only be the power_management.quirk.vbestate_restore quirk.

  $ sudo /etc/init.d/hal restart
  $ lshal | grep quirk

Key Bindings

Add an ACPI event by creating the following file:

  $ cat <<EOF | sudo tee -a /etc/acpi/events/hibernatebtn
event=button[ /]suspend

This will call the hibernate button script when the suspend key is pressed. See Linux (Debian Squeeze) on Thinkpad T500 for more information. That document also contains scripts and instructions for setting other keys to work with xbindkeys.


The following is a summary from Linux (Debian Squeeze) on Thinkpad T500.

  1. Install the following packages:

    $ sudo apt-get install xbindkeys xbindkeys-config xosd-bin
  2. Ensure xbindkeys is running when you start X by adding the following to ~/.profile:

    $ cat <<EOF>> ~/.profile
    xbindkeys &
  3. Optionally, create a script to show the brightness level when the 'brightness' buttons are pressed:

    $ cat <<EOF | sudo tee -a /usr/local/bin/
    # from
    if [ -n "$XAUTHORITY" ]; then
      # kill other osd_cat processes to prevent overlapping
      if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
        killall osd_cat
      i=$(cat /sys/class/backlight/acpi_video0/brightness)
      let i_perc=(100*$i)/15
      osd_cat -d 1 -A center -p bottom -o 50 -c yellow -s 1 \
        -f -adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1 \
        -b percentage -P $i_perc -T "Brightness: $i / 15"

    Check that the path /sys/class/backlight/acpi_video0/brightness is appropriate for you and change if necessary.

  4. Optionally, create a script for switching between touchpad, Trackpoint and both:

    $ cat <<EOF | sudo tee -a /usr/local/bin/
    # from
    # adapted from
    if synclient -l | grep -q TouchpadOff[^[:alnum:]]*0 ; then    
       synclient TouchpadOff=1                                    
       status="TouchPad OFF"                                      
       synclient TouchpadOff=0
       status="TouchPad ON"
    # kill other osd_cat processes to prevent overlapping
    if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
      killall osd_cat
    if [ -n "$XAUTHORITY" ]; then
      echo $status | osd_cat -d 3 -p bottom -A center -o -50 -s 1 -c green \
      -f -adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1
  5. Optionally, create a script for handling the volume keys:

    $ cat <<EOF | sudo tee -a /usr/local/bin/
    # from
    # adapted from
    if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
      p=$(basename $0)
      cat <<HERE
      Usage: $p <channel> <option>
      where option is in {+, -, m, u} or is a percent
      e.g. $p 50       # sets $CHANNEL to 50%
           $p Front m  # toggles the mute of the channel Front
      exit 0
    if [ $# -eq 2 ] ; then
    function vol_level {
      amixer get $CHANNEL |\
      grep 'Front Left:'  |\
      cut -d " " -f 7     |\
      sed 's/[^0-9]//g'
    function osd {
      killall osd_cat &> /dev/null
      echo $* |\
      osd_cat -d 2 -l 1 -p bottom -c green -s 1 -A center -o 50 \
      -f '-adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1' &
    function mute_osd {
        if [ $(amixer get $CHANNEL | grep Playback | grep "\[on\]" | wc -l) -gt 0 ]
            osd $CHANNEL Unmuted
            osd $CHANNEL Muted
    function vol_osd {
      killall osd_cat &> /dev/null
      osd_cat -d 2 -l 2 -p bottom -c green -s 1 -A center -o 50 \
      -f '-adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1' \
        -T "Volume ($CHANNEL) : $(vol_level) %" -b percentage -P $(vol_level) &
    case "$1" in
        amixer -q set $CHANNEL 5%+
        amixer -q set $CHANNEL 5%-
        amixer -q set $CHANNEL toggle
        amixer -q set $CHANNEL $1%
  6. Optionally, create a script for displaying battery information:

    $ cat <<EOF | sudo tee -a /usr/local/bin/
    # from
    # path to your battery. make sure it's correct
    if [ -n "$XAUTHORITY" ]; then
        # kill other osd_cat processes to prevent overlapping
        if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
            killall osd_cat
        BAT_FULL=$(cat $BAT_PATH/energy_full)
        BAT_NOW=$(cat $BAT_PATH/energy_now)
        STATUS=$(cat $BAT_PATH/status)
        let perc=(100*$BAT_NOW)/$BAT_FULL
        osd_cat -d 2 -A center -p bottom -o 50 -c yellow -s 1 \
         -f -adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1 \
         -b percentage -P $perc -T "Battery $perc % loaded, $STATUS"
  7. Run the xbindkeys-config GUI to bind the following keys to the appropriate actions:

    The xbindkeys utility stores the configuration settings in ~/.xbindkeysrc.

Name Key Action

Brightness Up XF86MonBrightnessUp /usr/local/bin/ Brightness Down XF86MonBrightnessDown /usr/local/bin/ Toggle Touchpad NoSymbol /usr/local/bin/ Configure Display XF86Display arandr Volume Up XF86AudioRaiseVolume /usr/local/bin/ "+" Volume Down XF86AudioLowerVolume /usr/local/bin/ "-" Volume Mute XF86AudioMute /usr/local/bin/ m Screen Lock XF86ScreenSaver xscreensaver-command -lock Battery Status XF86Battery /usr/local/bin/

Checking whether suspend-hybrid is supported

The pm-is-supported script can be used to see what operations are supported. It is intended to be called by other scripts, but it's return result can be seen and tested with either of the following commands. (If the first command prints a 0, then it is supported, if a 1, it is not supported.)

  $ pm-is-supported --suspend-hybrid; echo "$?"
  $ pm-is-supported --suspend-hybrid && echo "True"

Screen Lock

Screen locking can be disabled by setting LOCK_SCREEN to true in /etc/default/acpi-support. Note that there may be other reasons why the screen gets locked. E.g. with LXDE, selecting Hibernate from the LXDE Logout Menu, locks the screen anyway.


Integrated Graphics Card

Suspending after having performed a sleep seems to frequently result in being unable to shutdown the system. Some aspects work, others are unresponsive. E.g. Unable to kill lxpanel when using LXDE. This seems to only occur after a previous sleep. Also, there is a possibility that it's aggravated by running the Google Chrome Web-Browser.

Generally, sleep and suspend appear far more reliable when using the discrete (ATI Radeon HD 3650) graphics card, rather than the integrated (Intel Mobile 4 Series) graphics card.

See also HOWTO: Enabling Kernel Mode Setting (KMS) in Debian Linux kernel which describes rebuilding the kernel with KMS enabled (CONFIG_DRM_I915=m and CONFIG_DRM_I915_KMS=m) and booting with command line parameters of video=i915:modeset=1 (ensuring vga=791 is not used).

An alternative is to install the xserver-xorg-video-intel package from Debian Backports. Due to packaging dependencies, this also updates the ATI Radeon drivers for the discrete graphics card (the xserver-xorg-video-radeon package).

  $ cat <<EOF | sudo tee -a /etc/apt/sources.list.d/squeeze-backports.list
deb squeeze-backports main

  $ sudo apt-get update
  $ sudo apt-get -t squeeze-backports install xserver-xorg-video-intel

Discrete Graphics Card

I was getting long delays during sleep, suspend and thaw, adding about one minute to the process. Installing the firmware-linux-nonfree package resolves the issues.

If Totem/Movie Player appears to be playing very dark or completely black video, check the contrast setting is not at zero under Edit->Preferences->Display.

There are two sets of drivers available on Debian. There are the radeon open source driver and the fglrx proprietary driver. There are pros and cons between the two. Primarily, the radeon open source driver enables native resolution on the console, but does not provide 3D functionality. The proprietary fglrx one does not provide native resolution on the console, but does provide 3D functionality.

By default, Debian installs the open source Radeon drivers. To install the proprietary drivers, see Installing proprietary ATI driver fglrx/Catalyst - Debian.

Removing the radeon open source drivers

Before installing the flrx drivers, remove and purge the open source ones:

  sudo apt-get purge xserver-xorg-video-ati xserver-xorg-video-radeon

Installing the fglrx drivers

  sudo apt-get install fglrx-driver fglrx-control fglrx-glx \
  fglrx-atieventsd fglrx-modules-dkms

Removing the fglrx drivers

Before installing the open source drivers, remove and purge the fglrx ones:

  sudo apt-get purge fglrx-driver fglrx-control fglrx-glx \
  fglrx-atieventsd fglrx-modules-dkms

Installing the radeon open source drivers

  sudo apt-get install xserver-xorg-video-ati

Network Manager

Occasionally, after that, Network Manager's state remains or becomes 'disconnected'. You can see the state with the following command.

  $ sudo dbus_send --print-reply --system \
              --type=method_call \
              --dest=org.freedesktop.NetworkManager \
              /org/freedesktop/NetworkManager       \

The returned result has the following meaning:

The NetworkManager daemon is in an unknown state.
The NetworkManager daemon is asleep and all interfaces managed by it are inactive.
The NetworkManager daemon is connecting a device.
The NetworkManager daemon is connected.
The NetworkManager daemon is disconnected.

It is usually sufficient re-connect the network device using the Network Manager applet, e.g. click on Auto eth0 under the list of 'Available' networks. Failing that, Network Manager can be restarted with:

  $ sudo /etc/init.d/network-manager restart


Occasionally, after thaw, bluetooth is not enabled. Usually, you can just run the bluetooth manager and re-enable it. Alternatively, physically switch the bluetooth/wireless hardware off and on again.

The state has been correctly saved in /var/run/pm-utils/pm-suspend/storage/state:ibm_bluetooth as enabled but fails to start.

This condition also seems to result in messages similar to connect-debounce failed port x disabled being written to tty terminals.

Alternatively, the following command re-enables bluetooth:

  $ echo "enable" | sudo tee /proc/acpi/ibm/bluetooth

Battery Drain Whilst Hibernated


Xen dom0 fails to suspend for me - just hangs. It appears to be outstanding in the Xen Roadmap.


-- Frank Dean - 3 Dec 2011

Related Topics: ThinkPadBlueTooth, LenovoTips