I have figured out the cause of this bug, and it is not in the kernel.

I have kubuntu-desktop,  kpowersave, and powersaved installed and
running on my laptop.  The bug originates in the way that kpowersave
interacts with the suspend (to RAM) scripts from hal and powersaved.   I
believe the following description is accurate:

(1) When kpowersave detects an event that should trigger a suspend to RAM (lid 
closure, "sleep" button pressed, or selecting suspend to RAM from the panel 
applet menu), it (somehow) invokes the script:
/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux

(2) The /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux script
checks to see which tools are available:

#Other distros just need to have *any* tools installed
else
        if [ -x "/usr/sbin/pm-suspend" ] ; then
                /usr/sbin/pm-suspend $QUIRKS
                RET=$?
        elif [ -x "/usr/bin/powersave" ] ; then
                $POWERSAVED_SUSPEND2RAM
                RET=$?
        elif [ -x "/usr/sbin/hibernate" ] ; then
                # Use hibernate configured for suspend-to-ram
                /usr/sbin/hibernate -F/etc/hibernate/ram.conf
                RET=$?
        elif [ -x "/etc/acpi/sleep.sh" ] ; then
                # Use acpi-support for suspend to ram
                /etc/acpi/sleep.sh force
                RET=$?
        elif [ -x "/usr/sbin/s2ram" ] ; then
                # uswsusp tools installed
                /usr/sbin/s2ram
                RET=$?
        elif [ -x "/usr/sbin/pmi" ] ; then
                /usr/sbin/pmi action suspend force
                RET=$?
        elif [ -w "/sys/power/state" ] ; then
                # Use the raw kernel sysfs interface
                echo "mem" > /sys/power/state
                RET=$?
        else
                # TODO: add other scripts support
                unsupported
        fi
fi

(3) When powersaved is installed (which includes /usr/bin/powersave), it
"wins", and the powersave suspend script
(/usr/lib/powersave/do_acpi_sleep) gets run

(4) The do_acpi_sleep script has a section that checks to see if the
s2ram executable is available:

       if [ -x $S2RAM ]; then
                echo "Executing '$S2RAM $S2RAM_OPTS'" >> $S2RAM_LOG
                $S2RAM $S2RAM_OPTS >> $S2RAM_LOG 2>&1
                RET=$?
                case $RET in
                        127) $NOTIFY $S2RAM_NOT_SUPPORTED & ;;
                        126) $NOTIFY $S2RAM_FB_ONLY & ;;
                esac
        else
                echo "$S2RAM not found, falling back to echo." >> $S2RAM_LOG
                $MYECHO /sys/power/state mem
                RET=$?
        fi

(5) s2ram is part of the uswsusp package, which is not required by
powersaved, and so was not installed on my system.  Without s2ram, the
do_acpi_sleep script suspends the computer simply by echoing "mem" to
/sys/power/state.   On my laptop model, this causes problems on resume
(the video does not get restarted properly).  This is likely to cause
problems for other laptop models as well.

(6) The fix was to install the uswsusp package, and edit the configuration file 
for powersave (/etc/powersave/sleep) to set these two variables:
SUSPEND2RAM_FORCE="yes"
SUSPEND2RAM_VBE_POST="yes"

SUSPEND2RAM_FORCE has to be set to "yes" because the s2ram program does
not recognize my laptop model, and refuses to run unless forced.  Also,
s2ram must run in order for the second setting,
SUSPEND2RAM_VBE_POST="yes", to have any effect.

With these changes in place (install uswsusp, and edit
/etc/powersave/sleep as above), both suspend to RAM and suspend to DISK
now work nearly flawlessly on my laptop.  I have verified that this
solution works with both the 2.6.17 kernel (from Edgy) and the 2.6.20
(from Feisty, which I am now running).

NOTE:  If you are reading this and you have a Lenovo 3000 N100 laptop,
the designation "3000 N100" is not a model number.  There are several
different model Lenovo laptops that are called 3000 N100 (mine is a
model 0689-6EU).  If you have a different model of Lenovo 3000 N100, you
may get different results from me.

-- 
suspend/resume broken on Lenovo 3000 N100 
https://bugs.launchpad.net/bugs/63834
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to