From Fedora Project Wiki

No edit summary
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{QA/Test_Case
{{QA/Test_Case
|description=This test case tests hibernation via the pm-hibernate command.
|description=This test case tests hibernation via the pm-hibernate command.
{{admon/warning|If you are running from the LiveCD / USB you will need physical swap partition on the host machine in order to run this test case. Swap on LVM / LUKS is currently not supported for the resume when running from the LiveCD / USB.}}
{{admon/note|This test case requires swap partition to be setup on host disk. Physical swap partition should work as well as swap on LVM/LUKS.}}
{{admon/warning|This test case will write and destroy data previously stored on your host swap. If running from live media this is quite hackish approach and something may go wrong. Making backups of your data before running this test case is highly recommended. If you want to be safe and don't like livesystem to write to your host disk, feel free to skip this test case.}}
|setup=
|setup=
# Check that you have {{package|pm-utils}} installed:
# Check that you have {{package|pm-utils}} installed:
#:<pre># rpm -q pm-utils</pre>
#:<pre># rpm -q pm-utils</pre>
# Check that the hibernate is supported on your platform:
#:<pre>$ cat /sys/power/state</pre>
#:If there is ''disk'' in the output, it signals that the hibernate is supported.
# Check your swap:
# Check your swap:
#:<pre>$ swapon -s</pre>
#:You may see something like:
#:<pre>Filename       Type            Size    Used    Priority&#10;/dev/dm-2            partition      3997692 1856    -1</pre>
#:If you are running from the live medium note the filename of the swap partition with the highest priority (''/dev/dm-2'' in this case). It will be your resume partition. You will need this filename later when resuming. It is not needed if running installed system.
#Check your physical RAM size and swap size by:
#:<pre>$ free</pre>
#:<pre>$ free</pre>
{{admon/note|Your swap size should be at least your RAM size or more, otherwise the hibernate may fail. Even if your swap size is less than your RAM size, you can try this test case, but please signal this in your report, especially in case of failure.}}
{{admon/note|Your swap size should be your RAM size or more, otherwise the hibernation may fail. Even if your swap size is less than your RAM size the hibernation may work correctly (due to compression), but in case of failure please signal this in your report.}}
 
==Troubleshooting==
For cases you booted from the live medium and there is no active swap partition, but you have swap on the host disk LVM/LUKS (i.e. it wasn't detected) you may try to follow the steps bellow (you can combine them in cases you have e.g. LVM on LUKS, etc.). In case nothing helps feel free to skip this test case.
 
===LVM===
#Scan for logical volumes:
#:<pre># vgscan --mknodes &#10;# vgchange -a y&#10;# lvscan</pre>
#Find your swap (e.g. /dev/vg0/swap) and activate it:
#:<pre># swapon /dev/vg0/swap</pre>
 
You may also boot with the following dracut parameters (hit Tab in the live media boot menu) that should do the same (e.g. swap on vg0/swap):
rd.lvm.vg=vg0 rd.lvm.lv=vg0/swap
 
===LUKS===
#Unlock encrypted partition (e.g. /dev/sda2):
#:<pre># cryptsetup luksOpen /dev/sda2 crypt1</pre>
#:Or if you know the UUID (it can be obtained by cryptsetup luksUUID /dev/sda2) you may use:
#:<pre># cryptsetup luksOpen UUID=luks-fa649b04-5ede-496f-9168-331161a2b833 crypt1</pre>
#Activate swap:
#:<pre># swapon /dev/mapper/swap1</pre>
 
You may also boot with the following dracut parameters (hit Tab in the live media boot menu) that should do the same (only UUID is supported):
rd.luks.uuid=luks-fa649b04-5ede-496f-9168-331161a2b833


#* Your swap size should be at least twice your RAM size.


|actions=
|actions=
# Run the following command:
# Run the following command:
#:<pre># pm-hibernate</pre>
#:<pre># pm-hibernate</pre>
# Wait for hibernation process to complete (it can take cca. 5-60 seconds).
# Wait for hibernation process to complete (it typically takes cca. 2-60 seconds).
# Resume by hitting the power button.
# Resume by hitting the power button.
#: If you hibernated from the installed system it should work out of the box but if you hibernated from the live medium you may need to follow the following steps during the boot:
## Select boot from the live media.
## When the boot manager displays make sure the default option is selected (e.g. "Default" or "Start PM Test", the exact value depends on the medium/boot manager you are using) and edit the kernel boot parameters (mostly by hitting Tab).
## Append to the kernel boot parameters ''resume=/dev/dm-2'' (replace /dev/dm-2 by your swap partition, it is the filename you previously noted during the [[#Setup|setup]]) In case your resume partition is still not recognized you may try to add dracut boot parameters from [[#Troubleshooting|troubleshooting]].
## Boot (mostly by hitting Enter).
   
   
|results=
|results=

Latest revision as of 20:26, 11 October 2012

Description

This test case tests hibernation via the pm-hibernate command.

This test case requires swap partition to be setup on host disk. Physical swap partition should work as well as swap on LVM/LUKS.
This test case will write and destroy data previously stored on your host swap. If running from live media this is quite hackish approach and something may go wrong. Making backups of your data before running this test case is highly recommended. If you want to be safe and don't like livesystem to write to your host disk, feel free to skip this test case.

Setup

  1. Check that you have pm-utils installed:
    # rpm -q pm-utils
  2. Check that the hibernate is supported on your platform:
    $ cat /sys/power/state
    If there is disk in the output, it signals that the hibernate is supported.
  3. Check your swap:
    $ swapon -s
    You may see something like:
    Filename	      Type            Size    Used    Priority
    /dev/dm-2             partition       3997692 1856    -1
    If you are running from the live medium note the filename of the swap partition with the highest priority (/dev/dm-2 in this case). It will be your resume partition. You will need this filename later when resuming. It is not needed if running installed system.
  4. Check your physical RAM size and swap size by:
    $ free
Your swap size should be your RAM size or more, otherwise the hibernation may fail. Even if your swap size is less than your RAM size the hibernation may work correctly (due to compression), but in case of failure please signal this in your report.

Troubleshooting

For cases you booted from the live medium and there is no active swap partition, but you have swap on the host disk LVM/LUKS (i.e. it wasn't detected) you may try to follow the steps bellow (you can combine them in cases you have e.g. LVM on LUKS, etc.). In case nothing helps feel free to skip this test case.

LVM

  1. Scan for logical volumes:
    # vgscan --mknodes 
    # vgchange -a y
    # lvscan
  2. Find your swap (e.g. /dev/vg0/swap) and activate it:
    # swapon /dev/vg0/swap

You may also boot with the following dracut parameters (hit Tab in the live media boot menu) that should do the same (e.g. swap on vg0/swap):

rd.lvm.vg=vg0 rd.lvm.lv=vg0/swap

LUKS

  1. Unlock encrypted partition (e.g. /dev/sda2):
    # cryptsetup luksOpen /dev/sda2 crypt1
    Or if you know the UUID (it can be obtained by cryptsetup luksUUID /dev/sda2) you may use:
    # cryptsetup luksOpen UUID=luks-fa649b04-5ede-496f-9168-331161a2b833 crypt1
  2. Activate swap:
    # swapon /dev/mapper/swap1

You may also boot with the following dracut parameters (hit Tab in the live media boot menu) that should do the same (only UUID is supported):

rd.luks.uuid=luks-fa649b04-5ede-496f-9168-331161a2b833 

How to test

  1. Run the following command:
    # pm-hibernate
  2. Wait for hibernation process to complete (it typically takes cca. 2-60 seconds).
  3. Resume by hitting the power button.
    If you hibernated from the installed system it should work out of the box but if you hibernated from the live medium you may need to follow the following steps during the boot:
    1. Select boot from the live media.
    2. When the boot manager displays make sure the default option is selected (e.g. "Default" or "Start PM Test", the exact value depends on the medium/boot manager you are using) and edit the kernel boot parameters (mostly by hitting Tab).
    3. Append to the kernel boot parameters resume=/dev/dm-2 (replace /dev/dm-2 by your swap partition, it is the filename you previously noted during the setup) In case your resume partition is still not recognized you may try to add dracut boot parameters from troubleshooting.
    4. Boot (mostly by hitting Enter).

Expected Results

  1. System correctly hibernates.
  2. System correctly resumes.