Suspend and hibernate

Software
The following software can be used for in-kernel default suspend/hibernate implementation, namely, swsusp.

Also you must unmerge sys-power/upower and emerge sys-power/upower-pm-utils. Then in menu of your DE will button "Suspend" and "Hibernate". Checked on KDE 4.

Another alternative is which can be used with swsusp and TuxOnIce patched kernels.

Kernel
Make sure the following variables are set to 'yes':

Available suspend modes
To see available suspend modes use

for swsusp, default implementation.

Or else, probe  sysfs file for ToI.

Those two file will list at least ACPI S2/4 power down methods on modern hardware. New hardware would also support S5 method which is a rough S4 method. ACPI S2 correspond to suspend to ram (ram method is swsusp terms and 3 in ToI terms); S4 hibernation to disk (disk in swsusp temrs and 4 in ToI terms; S5 hibernation to disk (5 in ToI terms).

Swsusp users can choose between platfom, meaning ACPI, or *shutdown* methods which can be echo-ed to `/sys/power/disk' sysfs file.

Suspend to RAM
Preferred commands to suspend are

or

or

for suspend (to ram) for hibernate-script users; or

to hibernate (to disk.)

A more raw method is to

or

for TuxOnIce users. An then

is necessary to trigger a suspend/hibernation.

Suspend to disk
for suspend to disk make sure you have a swap partition or swap file The swap file should be active beforehand obviously and should be echo-ed on the appropriate file before any atempt to suspend/hibernate.

or

for ToI users.

Do not forget to probe

before issueing an actual command and append the result to kernel command line argument prepended with `resume='. This will suffice to resume from a block device or swap file for ToI. However, it's more complicated for a swapfile with swsusp.

Suspend to disk with sys-power/pm-utils
Yet another way to achieve disk hibernation is to use hibernate to swap partition and pm-utils.

First, make sure you have a swap partition set.

For this example, we will assume it's

Edit  and append the resume kernel option to   pointing to you swap partition.

Rebuild your grub2 config :

Next, try

Suspend to disk with swapfile
You can use suspend to disk with swapfile. You must create swapfile and configure GRUB.

Find UUID, where your swapfile place. For example /dev/sda (it may be LVM volume)

Find offset of swapfile on partition

After that edit GRUB config and add some parameters to boot string

Rebuild GRUB config

After reboot you can hibernate your system.

Troubleshooting
In troubleshooting suspend you can help log

Can not resume after suspend
In case resuming from suspend does not work, disable the security chip in BIOS/UEFI and try again.

Related links
Power management/Guide

TuxOnIce