Replace search suggestion with KernelModesetting page.
Replaced external link "ACPI HowTo" to last functioning snapshot at archive.org
|Deletions are marked like this.||Additions are marked like this.|
|Line 14:||Line 14:|
|Another option, under Gnome shell, is to simply press ALT before clicking the shutdown button in the user menu.|
|Line 188:||Line 189:|
| * ScreenLockingOnSleep
|Line 191:||Line 194:|
|* [[http://www.columbia.edu/~ariel/acpi/acpi_howto.html|ACPI HowTo]]||* [[http://web.archive.org/web/20101219095457/http://www.columbia.edu/~ariel/acpi/acpi_howto.html|ACPI HowTo]]|
|Line 196:||Line 199:|
| * [[http://gentoo-wiki.com/HOWTO_Software_Suspend_v2|Gentoo HOWTO_suspend: about the uswsusp package]]
* [[http://live.gnome.org/GnomePowerManager|Home of the Gnome Power Manager. The FAQ is interesting]]
| * [[https://wiki.archlinux.org/index.php/Software_suspend|ArchWiki - Uswsusp]]
* --([[http://www.gentoo-wiki.info/HOWTO_Software_Suspend_v2|Gentoo HOWTO_suspend: about the uswsusp package]])-- '''(DEPRECATED)'''
* Replaced by [[https://wiki.gentoo.org/wiki/Suspend_and_hibernate|Gentoo Wiki - Suspend and hibernate]]
* [[http://live.gnome.org/GnomePowerManager|Home of the Gnome Power Manager]] - The FAQ is interesting
Help on software suspend
This page gathers bits of information about getting software suspend to work in Debian. Because the core system components change rapidly among Debian versions, software suspend works differently on different versions of Debians. This page is divided according to Debian versions from new to old.
Software suspend is still experimental. Depending on your system, a few more steps are needed to get suspend partially or fully working. However, many people find that it works quite well now.
For more reading material, see also the links at the bottom of this page about hibernate and suspend.
Debian Jessie (8.0)
One option is to use the Gnome "suspend-button" extension at https://extensions.gnome.org/extension/826/suspend-button/
Another option, under Gnome shell, is to simply press ALT before clicking the shutdown button in the user menu.
Debian Wheezy (7.0)
Wheezy is still in testing status, so its configuration may change rapidly.
A very notable change is that HAL is phased out. If you still have the hal package installed, you should remove it or it will interference with pm-utils during suspend.
If the suspend / resume works well on your system, you are lucky and no need to read anything on this page. Or else, the first step to debug is to enable debugging for pm-utils, who control the suspend and resume process.
Enabling Debugging for pm-utils
The log of suspend and resume processes are in file /var/log/pm-suspend.log. It contains moderately verbose information by default. More information can be enabled for debugging by inserting line export PM_DEBUG=true into the beginning of file /usr/lib/pm-utils/pm-functions.
Fixing corrupted video on resume
A very common issue found after the computer resumes is corrupted video (or black screen, or no LCD backlight). The first step is to check whether the system is still running, which can be simply done by pressing the Capslock button and check whether the Capslock LED is changing accordingly. If the system is still running, in most cases we need to add a video quirk for your video card.
Debian now has kernel mode setting (KMS) enabled by default for most Intel, nVidia and ATI video cards. But pm-utils' video quirk does support KMS yet. So in most cases you should try disabling KMS first. The detail steps for your specific video card can be found on the KernelModesetting page.
After disabled KMS, if the video after resume still corrupts, you can try to suspend the system by using some video quirks. Read the manpage of the pm-suspend program for a very detail explanation of all the quirks available, and try the combinations of them from commandline. If you successfully find one combination of quirks that works for your system, you can add them into /usr/lib/pm-utils/video-quirks to make them permanent. At the same time, please help to file a bug against the pm-utils package with a patch about your changes so it can benefit the mass.
A common issue found on systems upgrading from old versions of Debian is the enabling of quirk-s3-bios freezes the system during suspend. If your system freezes during suspend, check the pm-suspend.log carefully after enabled debugging and make sure quirk-s3-bios is not used.
Debian Squeeze (6.0)
Debian Lenny (5.0)
Suspend under lenny using Hal and Gnome (example, kernel 2.6.21)
The gnome-power-manager package must be installed to enable suspend menu entries on the System -> Shut Down dialog.
However, power management events are not only initiated by the menu system. The computer's power button may be pressed, for example. A key package for Lenny's power management is HAL (hal)which watches for ACPI events. HAL has a built-in ACPI module, so you don't need to install the separate ACPI packages. However, the separate ACPI packages which provide acpid are still selected by the Debian installation process. HAL works with acpid if it is present; acpid is mature and its use with HAL is common. Recommendation: stick with the Debian default for a laptop install, and keep the acpi packages.
Apart from ACPI events, the desktop environment (such as gnome-power-manager) will create events. HAL will be asked to handle events initiated by gnome-power-manager (for example, the computer being idle for a certain time; by the way, the Gnome Power Manager lets the Gnome Screensaver determine if the computer is idle).
The policy manager (Gnome Power Manager) sends its request for action back to HAL, and HAL then looks for power management scripts to do the real work. Unfortunately these scripts are located in various places, so it is rather complicated to understand how it works. Further, there are different sets of power management packages, such as pm-utils, the recommended choice at the time of writing.
The package pm-utils is a package of power management software. It stands between HAL and actually suspending the system. pm-utils is designed for specific customisations to be "hooked" into it. This means that scripts in the directory /usr/lib/pm-utils/sleep.d are executed at suspend and resume. (pm-utils actually looks first in /etc/pm/sleep.d, but in the default Debian configuration these directories are empty). The system can be suspended by user action, or idle-time timeout: both cases go via pm-utils if you have the package configuration discussed in this article.
hibernate and "thaw" are handled almost the same as suspend/resume.
This is getting a bit complicated, so I will summarise where we are: You choose "suspend" from the menu. The gnome-power-manager sends a message to HAL, and HAL is pleased to find scripts from pm-utils: it calls pm-suspend. It may pass pm-suspend some specific instructions based on hardware quirks (see below).
If however you press the suspend key on your machine, this makes an ACPI event that is sent to HAL, which then hands off to the pm-utils script.
pm-suspend runs any scripts it finds to prepare for suspension. Some kernel modules are unloaded, for example. Then it calls a program to cause suspend to happen: this could be in the kernel, but the software provided by the packaged uswsusp is preferred, if present.
(note: the man page for pm-suspend is interesting and easy to understand)
All this message sending may seem like a lot of work, but by putting HAL in the centre, some big advantages are gained. One is that HAL includes a growing database of hardware, and it can use "quirks" to tweak the suspend, hibernate and resume operations. HAL therefore lets all Linux distributions share this hardware-specific knowledge. This database of quirks is in the Debian package hal-info.
The Gnome Power Manager FAQ (see links below) gives hints on sending power management messages to Gnome: for example, if you want to stop automatic suspend in a script.
The acpid and acpi-support packages install scripts in /etc/acpi and /etc/acpi/events. I don't think these scripts are used if you have HAL and pm-utils installed. If you want to change suspend behaviour, you need to concentrate on the scripts from pm-utils (below).
We stick with the script pm-suspend as the topic to explore further. It is a shell script, in /usr/sbin/pm-suspend. What it does is logged to /var/log/pm-suspend.log.
pm-suspend runs a number of shell scripts that do specific tasks to prepare for suspend, and then executes the the suspend. The suspend operation is optionally handled by the Linux kernel, but pm-suspend looks first to see if the package uswsusp is installed (more accurately, it looks for the program called s2ram). If it finds s2ram, it uses this. Using s2ram seems to be the preferred way of working.
You should also have a look at the log file mentioned above.
On my system, I see from the log file that /usr/lib/pm-utils/sleep.d is the source of about ten scripts executed when a suspend occurs. They are executed in alphabetical order. You will notice that the same scripts are executed on a resume, but in reverse order. There is a script to handle network connections: it calls the gnome network manager if present.
Note: there is a package called powersaved which also provides scripts to handle suspend. It is not installed by default by Debian. If it is installed, it seems to get priority over pm-utils, and for me, suspend no longer works. So I don't recommend to install powersaved. openSuse reports that from version 10.2 and later, it has migrated from powersave to pm-utils. See this page.
NOTE: You might experience problems with usb devices not suspending in the kernel log, forcing the computer to resume immediately. Look here for a solution: http://ubuntuforums.org/showthread.php?t=1444822 .
Summary of relevant packages for HAL and pm-utils
Here is a list of packages linked to power management. Only HAL seems to be necessary for gnome to work.
+ hal Central to the modern power management approach
+ hal-info rules for specific hardware
+ pm-utils required for the configuration discussed here. Key scripts are placed in /usr/sbin and /usr/lib/pm-utils/sleep.d
+ uswsusp optional but recommended by pm-utils. the pm-utils scripts look for the executables in this package. Try to see if suspend and hibernate works without it first (more details below)
+ powermgmt-base provides some status scripts that are relied upon by other parts of Gnome and Debian, but it is not central to the operation of suspend and resume.
+ acpi-support optional
+ acpid optional but recommended (HAL will use acpid if it is present)
+ acpi not needed
+ libacpi0 not needed
+ hibernate not needed
Tips on using s2ram from uswsusp package
The uswsusp package is optional, but highly recommended. s2ram comes with a database of known computers, but your computer configuration may not be included. To find out, from a root terminal, execute
to see if it works with your computer. You may get "unknown computer". In that case, try using the force option:
If this works, then you need to make the -f option the default for pm-utils.
If needed create, or edit near the top of the file /etc/pm/config.d/defaults to change the line with the options for s2ram. See this example:
####################################################################### # The following options require the uswsusp package being installed # what options should be passed to s2ram? # see http://en.opensuse.org/S2ram for more information # for hal 0.5.9 and up don't set this option to get the options supplied # by HAL S2RAM_OPTS="-f"
Now, suspend should work when using the uswsusp package.
This is a useful advanced reference: Gentoo HOWTO_suspend
Information for older kernels
Older versions of Debian do not use HAL as discussed above. They rely on the ACPI packages, and scripts handling acpi events.
The following scripts were needed to get suspend to ram working on a ThinkPad X22 running linux-image 2.6.14-2 and tracking unstable.
# enable xscreensaver source /proc/`pidof xscreensaver`/environ && xscreensaver-command -lock ## optional: eject all pcmcia devices #cardctl eject || true # go to sleep echo mem > /sys/power/state
Make sure the files you create in /etc/acpi/actions are executable:
$ sudo chmod +x /etc/acpi/actions/custom_sleep.sh
Kernel testing facility
Since linux 2.6.25, the kernel has a new Suspend testing facility changelog.
Introduce sysfs attribute /sys/power/pm_test allowing one to test the suspend core code. Namely, writing one of the strings below to this file causes the suspend code to work in one of the test modes defined as follows:
- test the freezing of processes
- test the freezing of processes and suspending of devices
- test the freezing of processes, suspending of devices and platform global control methods(*)
- test the freezing of processes, suspending of devices, platform global control methods and the disabling of nonboot CPUs
- test the freezing of processes, suspending of devices, platform global control methods, the disabling of nonboot CPUs and suspending of platform/system devices
(*) These are ACPI global control methods on ACPI systems
Then, if a suspend is started by normal means, the suspend core will perform its normal operations up to the point indicated by given test level. Next, it will wait for 5 seconds and carry out the resume operations needed to transition the system back to the fully functional state. Writing "none" to /sys/power/pm_test turns the testing off.
When open for reading, /sys/power/pm_test contains a space-separated list of all available tests (including "none" that represents the normal functionality) in which the current test level is indicated by square brackets.
The actual message (for googlers) are suspend debug: Waiting for 5 seconds.
The first two links refer to old approaches.
These are more modern links (> kernel 2.6.20)
Gentoo HOWTO_suspend: about the uswsusp package (DEPRECATED)
Replaced by Gentoo Wiki - Suspend and hibernate
Home of the Gnome Power Manager - The FAQ is interesting