个人工具

“UbuntuHelp:SuspendHowto”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/SuspendHowto}} {{Languages|UbuntuHelp:SuspendHowto}} NOTE: Suspend support is included in the Hoary release. Hoary users should see [[UbuntuHelp:H...)
 
第2行: 第2行:
 
{{Languages|UbuntuHelp:SuspendHowto}}
 
{{Languages|UbuntuHelp:SuspendHowto}}
 
NOTE: Suspend support is included in the Hoary release. Hoary users should see [[UbuntuHelp:HoaryPM]]
 
NOTE: Suspend support is included in the Hoary release. Hoary users should see [[UbuntuHelp:HoaryPM]]
 
 
NOTE: For succesful suspend to disk (hibernation), you need swap partition (or file, though I have not tested with swap file) bigger than is actual size of your memory. All your memory and also everything that was swaped at the time of hibernation must fit in swap, so at the size of swap should be 1.5x-2x bigger than size of your RAM.
 
NOTE: For succesful suspend to disk (hibernation), you need swap partition (or file, though I have not tested with swap file) bigger than is actual size of your memory. All your memory and also everything that was swaped at the time of hibernation must fit in swap, so at the size of swap should be 1.5x-2x bigger than size of your RAM.
 
== Introduction ==
 
== Introduction ==
 
 
Suspend mode is a special low-power mode, often used on laptops, that preserves the contents of RAM
 
Suspend mode is a special low-power mode, often used on laptops, that preserves the contents of RAM
 
while conserving power.
 
while conserving power.
 
 
There are two different standards for power management (which handles suspend in Linux), ACPI and APM.  ACPI has more advanced features, but is only found on computers made in the last few years.  APM is older, and somewhat more mature, but doesn't offer as many features as ACPI.  It also isn't available on many new PCs.
 
There are two different standards for power management (which handles suspend in Linux), ACPI and APM.  ACPI has more advanced features, but is only found on computers made in the last few years.  APM is older, and somewhat more mature, but doesn't offer as many features as ACPI.  It also isn't available on many new PCs.
 
 
Also, there are two main forms of suspend - suspend-to-RAM and suspend-to-disk
 
Also, there are two main forms of suspend - suspend-to-RAM and suspend-to-disk
 
(also known as "software suspend" or "hibernation").  Suspend-to-RAM uses more power, but is almost instant.  Suspend-to-disk, on the other hand, uses no power (the system actually powers off), but takes longer to suspend/resume.  This HOWTO will discuss all of these methods.
 
(also known as "software suspend" or "hibernation").  Suspend-to-RAM uses more power, but is almost instant.  Suspend-to-disk, on the other hand, uses no power (the system actually powers off), but takes longer to suspend/resume.  This HOWTO will discuss all of these methods.
 
 
WARNING:  This is not officially supported in Ubuntu Warty, and may cause system problems or data loss.
 
WARNING:  This is not officially supported in Ubuntu Warty, and may cause system problems or data loss.
 
Use with caution.
 
Use with caution.
 
 
== Suspending to RAM (APM) ==
 
== Suspending to RAM (APM) ==
 
 
To enable APM on a system:
 
To enable APM on a system:
 
*edit your /etc/modules file and add apm to the list of modules.
 
*edit your /etc/modules file and add apm to the list of modules.
第25行: 第18行:
 
*Finally, reboot the computer. If your system supports APM, everything should be set up.
 
*Finally, reboot the computer. If your system supports APM, everything should be set up.
 
Close the laptop lid (if you have a laptop) or press the Sleep button to suspend to RAM.
 
Close the laptop lid (if you have a laptop) or press the Sleep button to suspend to RAM.
 
 
Some systems may not work properly with this, and many new systems don't support APM at all.
 
Some systems may not work properly with this, and many new systems don't support APM at all.
 
In this case, search for information on suspending your particular laptop in the wiki or
 
In this case, search for information on suspending your particular laptop in the wiki or
第31行: 第23行:
 
management features of many newer laptops, and also doesn't work with suspend-to-disk using
 
management features of many newer laptops, and also doesn't work with suspend-to-disk using
 
the code in the kernel.
 
the code in the kernel.
 
 
== ACPI ==
 
== ACPI ==
 
 
To suspend to disk, choose "Hibernate" from the GNOME logout menu. To suspend to RAM, edit
 
To suspend to disk, choose "Hibernate" from the GNOME logout menu. To suspend to RAM, edit
 
<pre><nowiki>
 
<pre><nowiki>
第39行: 第29行:
 
</nowiki></pre>
 
</nowiki></pre>
 
and uncomment the second line by deleting the # character, to read:
 
and uncomment the second line by deleting the # character, to read:
 
 
<pre><nowiki>ACPI_SLEEP=true
 
<pre><nowiki>ACPI_SLEEP=true
 
</nowiki></pre>
 
</nowiki></pre>
 
 
==== Ubuntu 6.06 ====
 
==== Ubuntu 6.06 ====
 
 
Dapper needs another step to enable suspend. Execute gconf-editor, and visit apps/gnome-powermanager and enable "can_suspend". You can enable/disable suspend and/or hibernation from there.
 
Dapper needs another step to enable suspend. Execute gconf-editor, and visit apps/gnome-powermanager and enable "can_suspend". You can enable/disable suspend and/or hibernation from there.
 
 
If you have an nVidia card, visit the NvidiaLaptopBinaryDriverSuspend wiki page.
 
If you have an nVidia card, visit the NvidiaLaptopBinaryDriverSuspend wiki page.
 
 
For those running the fglrx driver, you need uncomment the line in /etc/default/fglrx, so it reads as
 
For those running the fglrx driver, you need uncomment the line in /etc/default/fglrx, so it reads as
 
<pre><nowiki>FGLRX_ACPI_SWITCH_POWERSTATES=true
 
<pre><nowiki>FGLRX_ACPI_SWITCH_POWERSTATES=true
 
</nowiki></pre>
 
</nowiki></pre>
 
 
The ipw2200 driver currently doesn't allow suspend. The easy workaround is to edit /etc/default/acpi-support, and add ipw2200 to the MODULES list, like so:
 
The ipw2200 driver currently doesn't allow suspend. The easy workaround is to edit /etc/default/acpi-support, and add ipw2200 to the MODULES list, like so:
 
<pre><nowiki>MODULES="ipw2200"
 
<pre><nowiki>MODULES="ipw2200"
 
</nowiki></pre>
 
</nowiki></pre>
 
 
=== Event Processing ===
 
=== Event Processing ===
 
 
For a working suspend and hibernate support several pieces of software have to work together, which results in a highly integrated system that needs to be understood in case troubleshooting is necessary. The following description should help to explain the processing of events as of Ubuntu 6.06 LTS (Dapper).
 
For a working suspend and hibernate support several pieces of software have to work together, which results in a highly integrated system that needs to be understood in case troubleshooting is necessary. The following description should help to explain the processing of events as of Ubuntu 6.06 LTS (Dapper).
 
+
# Press keyboard button (sleep, power)
* Press keyboard button (sleep, power)
+
# generation of events
* generation of events
+
## acpid
a. acpid
+
### /etc/acpi/events/{sleepbtn,powerbtn}
*** /etc/acpi/events/{sleepbtn,powerbtn}
+
### /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh
*** /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh
+
#### /etc/acpi/prepare.sh: includes /etc/acpi/suspend.d/*.sh
**** /etc/acpi/prepare.sh: includes /etc/acpi/suspend.d/*.sh
+
#### triggers suspend in kernel by ''echo $SLEEP_MODE > /sys/power/state''
**** triggers suspend in kernel by ''echo $SLEEP_MODE > /sys/power/state''
+
#### /etc/acpi/resume.sh: includes /etc/acpi/resume.d/*.sh
**** /etc/acpi/resume.sh: includes /etc/acpi/resume.d/*.sh
+
 
b. hal event
 
b. hal event
*** gnome-power-manager or klaptopd kicks in and looks up its policy
+
# gnome-power-manager or klaptopd kicks in and looks up its policy
*** /usr/share/hal/scripts/hal-system-power-{suspend,hibernate}
+
# /usr/share/hal/scripts/hal-system-power-{suspend,hibernate}
**** checks for avaiable handlerss: powersave, '''pmi''', pm-hibernate, hibernate, direct /sys/power/state
+
## checks for avaiable handlerss: powersave, '''pmi''', pm-hibernate, hibernate, direct /sys/power/state
**** /usr/sbin/pmi action {suspend,hibernate} force
+
## /usr/sbin/pmi action {suspend,hibernate} force
***** /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh  ''# following processing as described for the acpid case''
+
### /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh  ''# following processing as described for the acpid case''
 
+
 
This should help to understand ''"What happens, when XX button is pressed?"''. In case something in the path is not working, this should help to adopt the scripts, add debugging and fix the problems.
 
This should help to understand ''"What happens, when XX button is pressed?"''. In case something in the path is not working, this should help to adopt the scripts, add debugging and fix the problems.
 
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 21:37的版本

NOTE: Suspend support is included in the Hoary release. Hoary users should see UbuntuHelp:HoaryPM NOTE: For succesful suspend to disk (hibernation), you need swap partition (or file, though I have not tested with swap file) bigger than is actual size of your memory. All your memory and also everything that was swaped at the time of hibernation must fit in swap, so at the size of swap should be 1.5x-2x bigger than size of your RAM.

Introduction

Suspend mode is a special low-power mode, often used on laptops, that preserves the contents of RAM while conserving power. There are two different standards for power management (which handles suspend in Linux), ACPI and APM. ACPI has more advanced features, but is only found on computers made in the last few years. APM is older, and somewhat more mature, but doesn't offer as many features as ACPI. It also isn't available on many new PCs. Also, there are two main forms of suspend - suspend-to-RAM and suspend-to-disk (also known as "software suspend" or "hibernation"). Suspend-to-RAM uses more power, but is almost instant. Suspend-to-disk, on the other hand, uses no power (the system actually powers off), but takes longer to suspend/resume. This HOWTO will discuss all of these methods. WARNING: This is not officially supported in Ubuntu Warty, and may cause system problems or data loss. Use with caution.

Suspending to RAM (APM)

To enable APM on a system:

  • edit your /etc/modules file and add apm to the list of modules.
  • edit the defoptions line of your /boot/grub/menu.lst file so that it ends with acpi=off, and then sudo update-grub to update the GRUB configuration.
  • Add the modules shpchp and pciehp to the end of the /etc/modprobe.d/blacklist file (they don't work w/APM).
  • Finally, reboot the computer. If your system supports APM, everything should be set up.

Close the laptop lid (if you have a laptop) or press the Sleep button to suspend to RAM. Some systems may not work properly with this, and many new systems don't support APM at all. In this case, search for information on suspending your particular laptop in the wiki or elsewhere. Also, if APM doesn't work, try ACPI. Note that APM doesn't support all the power management features of many newer laptops, and also doesn't work with suspend-to-disk using the code in the kernel.

ACPI

To suspend to disk, choose "Hibernate" from the GNOME logout menu. To suspend to RAM, edit

/etc/default/acpi-support

and uncomment the second line by deleting the # character, to read:

ACPI_SLEEP=true

Ubuntu 6.06

Dapper needs another step to enable suspend. Execute gconf-editor, and visit apps/gnome-powermanager and enable "can_suspend". You can enable/disable suspend and/or hibernation from there. If you have an nVidia card, visit the NvidiaLaptopBinaryDriverSuspend wiki page. For those running the fglrx driver, you need uncomment the line in /etc/default/fglrx, so it reads as

FGLRX_ACPI_SWITCH_POWERSTATES=true

The ipw2200 driver currently doesn't allow suspend. The easy workaround is to edit /etc/default/acpi-support, and add ipw2200 to the MODULES list, like so:

MODULES="ipw2200"

Event Processing

For a working suspend and hibernate support several pieces of software have to work together, which results in a highly integrated system that needs to be understood in case troubleshooting is necessary. The following description should help to explain the processing of events as of Ubuntu 6.06 LTS (Dapper).

  1. Press keyboard button (sleep, power)
  2. generation of events
    1. acpid
      1. /etc/acpi/events/{sleepbtn,powerbtn}
      2. /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh
        1. /etc/acpi/prepare.sh: includes /etc/acpi/suspend.d/*.sh
        2. triggers suspend in kernel by echo $SLEEP_MODE > /sys/power/state
        3. /etc/acpi/resume.sh: includes /etc/acpi/resume.d/*.sh

b. hal event

  1. gnome-power-manager or klaptopd kicks in and looks up its policy
  2. /usr/share/hal/scripts/hal-system-power-{suspend,hibernate}
    1. checks for avaiable handlerss: powersave, pmi, pm-hibernate, hibernate, direct /sys/power/state
    2. /usr/sbin/pmi action {suspend,hibernate} force
      1. /etc/acpi/sleep.sh or /etc/acpi/hibernate.sh # following processing as described for the acpid case

This should help to understand "What happens, when XX button is pressed?". In case something in the path is not working, this should help to adopt the scripts, add debugging and fix the problems.