| 1 | <?xml version='1.0' encoding="UTF-8"?> |
1 | <?xml version='1.0' encoding="UTF-8"?> |
| 2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
2 | <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
| 3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.32 2007/12/03 19:31:10 swift Exp $ --> |
3 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/power-management-guide.xml,v 1.33 2008/01/21 12:12:12 jkt Exp $ --> |
| 4 | <guide link="/doc/en/power-management-guide.xml"> |
4 | <guide link="/doc/en/power-management-guide.xml"> |
| 5 | <title>Power Management Guide</title> |
5 | <title>Power Management Guide</title> |
| 6 | |
6 | |
| 7 | <author title="Author"> |
7 | <author title="Author"> |
| 8 | <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail> |
8 | <mail link="earthwings@gentoo.org">Dennis Nienhüser</mail> |
| … | |
… | |
| 21 | |
21 | |
| 22 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
22 | <!-- The content of this document is licensed under the CC-BY-SA license --> |
| 23 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
23 | <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
| 24 | <license/> |
24 | <license/> |
| 25 | |
25 | |
| 26 | <version>1.37</version> |
26 | <version>1.38</version> |
| 27 | <date>2007-12-03</date> |
27 | <date>2008-01-21</date> |
| 28 | |
28 | |
| 29 | <chapter> |
29 | <chapter> |
| 30 | <title>Introduction</title> |
30 | <title>Introduction</title> |
| 31 | <section> |
31 | <section> |
| 32 | <body> |
32 | <body> |
| … | |
… | |
| 152 | most out of it. |
152 | most out of it. |
| 153 | </p> |
153 | </p> |
| 154 | |
154 | |
| 155 | <p> |
155 | <p> |
| 156 | There are different kernel sources in Portage. I'd recommend using |
156 | There are different kernel sources in Portage. I'd recommend using |
| 157 | <c>gentoo-sources</c> or <c>suspend2-sources</c>. The latter contains patches |
157 | <c>gentoo-sources</c> or <c>tuxonice-sources</c>. The latter contains patches |
| 158 | for Software Suspend 2, see the chapter about <uri link="#doc_chap7">sleep |
158 | for TuxOnIce, see the chapter about <uri link="#doc_chap7">sleep |
| 159 | states</uri> for more details. When configuring the kernel, activate at least |
159 | states</uri> for more details. When configuring the kernel, activate at least |
| 160 | these options: |
160 | these options: |
| 161 | </p> |
161 | </p> |
| 162 | |
162 | |
| 163 | <pre caption="Minimum kernel setup for Power Management (Kernel 2.6)"> |
163 | <pre caption="Minimum kernel setup for Power Management (Kernel 2.6)"> |
| … | |
… | |
| 1330 | Shutdown any NFS or samba server/client before hibernating. |
1330 | Shutdown any NFS or samba server/client before hibernating. |
| 1331 | </warn> |
1331 | </warn> |
| 1332 | |
1332 | |
| 1333 | <p> |
1333 | <p> |
| 1334 | There are two different implementations for S4. The original one is swsusp, |
1334 | There are two different implementations for S4. The original one is swsusp, |
| 1335 | then there is the newer suspend2 with a nicer interface (including fbsplash |
1335 | then there is the newer tuxonice (former suspend2) with a nicer interface (including fbsplash |
| 1336 | support). A <uri link="http://suspend2.net/features.html#compare"> feature |
1336 | support). A <uri link="http://tuxonice.net/features.html#compare"> feature |
| 1337 | comparison</uri> is available at the <uri link="http://suspend2.net"> suspend2 |
1337 | comparison</uri> is available at the <uri link="http://www.tuxonice.net">tuxonice |
| 1338 | Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of swsusp, |
1338 | Homepage</uri>. There used to be Suspend-to-Disk (pmdisk), a fork of swsusp, |
| 1339 | but it has been merged back. |
1339 | but it has been merged back. |
| 1340 | </p> |
1340 | </p> |
| 1341 | |
1341 | |
| 1342 | <p> |
1342 | <p> |
| 1343 | Suspend2 is not included in the mainline kernel yet, therefore you either have |
1343 | TuxOnIce is not included in the mainline kernel yet, therefore you either have |
| 1344 | to patch your kernel sources with the patches provided by <uri |
1344 | to patch your kernel sources with the patches provided by <uri |
| 1345 | link="http://suspend2.net">suspend2.net</uri> or use |
1345 | link="http://tuxonice.net">tuxonice.net</uri> or use |
| 1346 | <c>sys-kernel/suspend2-sources</c>. |
1346 | <c>sys-kernel/tuxonice-sources</c>. |
| 1347 | </p> |
|
|
| 1348 | |
|
|
| 1349 | <p> |
1347 | </p> |
|
|
1348 | |
|
|
1349 | <p> |
| 1350 | The kernel part for both swusp and suspend2 is as follows: |
1350 | The kernel part for both swusp and TuxOnIce is as follows: |
| 1351 | </p> |
1351 | </p> |
| 1352 | |
1352 | |
| 1353 | <pre caption="Kernel configuration for the various suspend types"> |
1353 | <pre caption="Kernel configuration for the various suspend types"> |
| 1354 | Power Management Options ---> |
1354 | Power Management Options ---> |
| 1355 | <comment>(hibernate with swsusp)</comment> |
1355 | <comment>(hibernate with swsusp)</comment> |
| 1356 | [*] Software Suspend |
1356 | [*] Software Suspend |
| 1357 | <comment>(replace /dev/SWAP with your swap partition)</comment> |
1357 | <comment>(replace /dev/SWAP with your swap partition)</comment> |
| 1358 | (/dev/SWAP) Default resume partition |
1358 | (/dev/SWAP) Default resume partition |
| 1359 | |
1359 | |
| 1360 | <comment>(hibernate with suspend2)</comment> |
1360 | <comment>(hibernate with TuxOnIce)</comment> |
| 1361 | Software Suspend 2 |
1361 | Enhanced Hibernation (TuxOnIce) |
| 1362 | --- Image Storage (you need at least one writer) |
1362 | --- Image Storage (you need at least one writer) |
| 1363 | [*] File Writer |
1363 | [*] File Writer |
| 1364 | [*] Swap Writer |
1364 | [*] Swap Writer |
| 1365 | --- General Options |
1365 | --- General Options |
| 1366 | [*] LZF image compression |
1366 | [*] LZF image compression |
| … | |
… | |
| 1404 | <comment>(Make sure you have a backup of your data)</comment> |
1404 | <comment>(Make sure you have a backup of your data)</comment> |
| 1405 | # <i>hibernate</i> |
1405 | # <i>hibernate</i> |
| 1406 | </pre> |
1406 | </pre> |
| 1407 | |
1407 | |
| 1408 | <p> |
1408 | <p> |
| 1409 | The following section discusses the setup of suspend2 including fbsplash |
1409 | The following section discusses the setup of TuxOnIce including fbsplash |
| 1410 | support for a nice graphical progress bar during suspend and resume. |
1410 | support for a nice graphical progress bar during suspend and resume. |
| 1411 | </p> |
1411 | </p> |
| 1412 | |
1412 | |
| 1413 | <p> |
1413 | <p> |
| 1414 | The first part of the configuration is similar to the configuration of swsusp. |
1414 | The first part of the configuration is similar to the configuration of swsusp. |
| 1415 | In case you didn't store the location of your swap partition in the kernel |
1415 | In case you didn't store the location of your swap partition in the kernel |
| 1416 | config, you have to pass it as a kernel parameter with the |
1416 | config, you have to pass it as a kernel parameter with the |
| 1417 | <c>resume2=swap:/dev/SWAP</c> directive. If booting is not possible due to a |
1417 | <c>resume=swap:/dev/SWAP</c> directive. If booting is not possible due to a |
| 1418 | broken image, append the <c>noresume2</c> parameter. Additionally, the |
1418 | broken image, append the <c>noresume</c> parameter. Additionally, the |
| 1419 | <c>hibernate-cleanup</c> init script invalidates suspend2 images during the |
1419 | <c>hibernate-cleanup</c> init script invalidates TuxOnIce images during the |
| 1420 | boot process. |
1420 | boot process. |
| 1421 | </p> |
1421 | </p> |
| 1422 | |
1422 | |
| 1423 | <pre caption="Invalidating suspend2 images during the boot process"> |
1423 | <pre caption="Invalidating TuxOnIce images during the boot process"> |
| 1424 | # <i>rc-update add hibernate-cleanup boot</i> |
1424 | # <i>rc-update add hibernate-cleanup boot</i> |
| 1425 | </pre> |
1425 | </pre> |
| 1426 | |
1426 | |
| 1427 | <p> |
1427 | <p> |
| 1428 | Now edit <path>/etc/hibernate/suspend2.conf</path>, enable the <c>suspend2</c> |
1428 | Now edit <path>/etc/hibernate/suspend2.conf</path>, enable the <c>TuxOnIce</c> |
| 1429 | options you need. Do not enable the <c>fbsplash</c> options in |
1429 | options you need. Do not enable the <c>fbsplash</c> options in |
| 1430 | <c>common.conf</c> just yet. |
1430 | <c>common.conf</c> just yet. |
| 1431 | </p> |
1431 | </p> |
| 1432 | |
1432 | |
| 1433 | <pre caption="Hibernating with suspend2"> |
1433 | <pre caption="Hibernating with TuxOnIce"> |
| 1434 | # <i>nano -w /etc/hibernate/suspend2.conf</i> |
1434 | # <i>nano -w /etc/hibernate/suspend2.conf</i> |
| 1435 | <comment>(Make sure you have a backup of your data)</comment> |
1435 | <comment>(Make sure you have a backup of your data)</comment> |
| 1436 | # <i>hibernate</i> |
1436 | # <i>hibernate</i> |
| 1437 | </pre> |
1437 | </pre> |
| 1438 | |
1438 | |
| 1439 | <p> |
1439 | <p> |
| 1440 | Please configure <c>fbsplash</c> now if you didn't do already. To enable |
1440 | Please configure <c>fbsplash</c> now if you didn't do already. To enable |
| 1441 | fbsplash support during hibernation, the <c>sys-apps/suspend2-userui</c> |
1441 | fbsplash support during hibernation, the <c>sys-apps/tuxonice-userui</c> |
| 1442 | package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE |
1442 | package is needed. Additionally, you've got to enable the <c>fbsplash</c> USE |
| 1443 | flag. |
1443 | flag. |
| 1444 | </p> |
1444 | </p> |
| 1445 | |
1445 | |
| 1446 | <pre caption="Installing suspend2-userui"> |
1446 | <pre caption="Installing tuxonice-userui"> |
| 1447 | # <i>echo "sys-apps/suspend2-userui fbsplash" >> /etc/portage/package.use</i> |
1447 | # <i>echo "sys-apps/tuxonice-userui fbsplash" >> /etc/portage/package.use</i> |
| 1448 | <comment>(It may be marked ~arch, so first it must be keyworded)</comment> |
1448 | <comment>(It may be marked ~arch, so first it must be keyworded)</comment> |
| 1449 | # <i>echo "sys-apps/suspend2-userui" >> /etc/portage/package.keywords</i> |
1449 | # <i>echo "sys-apps/tuxonice-userui" >> /etc/portage/package.keywords</i> |
| 1450 | # <i>emerge suspend2-userui</i> |
1450 | # <i>emerge tuxonice-userui</i> |
| 1451 | </pre> |
1451 | </pre> |
| 1452 | |
1452 | |
| 1453 | <p> |
1453 | <p> |
| 1454 | The ebuild tells you to make a symlink to the theme you want to use. For |
1454 | The ebuild tells you to make a symlink to the theme you want to use. For |
| 1455 | example, to use the <c>livecd-2005.1</c> theme, run the following command: |
1455 | example, to use the <c>livecd-2005.1</c> theme, run the following command: |
| … | |
… | |
| 1459 | # <i>ln -sfn /etc/splash/livecd-2005.1 /etc/splash/suspend2</i> |
1459 | # <i>ln -sfn /etc/splash/livecd-2005.1 /etc/splash/suspend2</i> |
| 1460 | </pre> |
1460 | </pre> |
| 1461 | |
1461 | |
| 1462 | <p> |
1462 | <p> |
| 1463 | If you don't want a black screen in the first part of the resume process, you |
1463 | If you don't want a black screen in the first part of the resume process, you |
| 1464 | have to add the <c>suspend2ui_fbsplash</c> tool to your initrd image. Assuming |
1464 | have to add the <c>tuxoniceui_fbsplash</c> tool to your initrd image. Assuming |
| 1465 | you created the initrd image with <c>splash_geninitramfs</c> and saved it as |
1465 | you created the initrd image with <c>splash_geninitramfs</c> and saved it as |
| 1466 | <path>/boot/fbsplash-emergence-1024x768</path>, here's how to do that. |
1466 | <path>/boot/fbsplash-emergence-1024x768</path>, here's how to do that. |
| 1467 | </p> |
1467 | </p> |
| 1468 | |
1468 | |
| 1469 | <pre caption="Adding suspend2ui_fbsplash to an initrd image"> |
1469 | <pre caption="Adding tuxoniceui_fbsplash to an initrd image"> |
| 1470 | # <i>mount /boot</i> |
1470 | # <i>mount /boot</i> |
| 1471 | # <i>mkdir ~/initrd.d</i> |
1471 | # <i>mkdir ~/initrd.d</i> |
| 1472 | # <i>cp /boot/fbsplash-emergence-1024x768 ~/initrd.d/</i> |
1472 | # <i>cp /boot/fbsplash-emergence-1024x768 ~/initrd.d/</i> |
| 1473 | # <i>cd ~/initrd.d</i> |
1473 | # <i>cd ~/initrd.d</i> |
| 1474 | # <i>gunzip -c fbsplash-emergence-1024x768 | cpio -idm --quiet -H newc</i> |
1474 | # <i>gunzip -c fbsplash-emergence-1024x768 | cpio -idm --quiet -H newc</i> |
| 1475 | # <i>rm fbsplash-emergence-1024x768</i> |
1475 | # <i>rm fbsplash-emergence-1024x768</i> |
| 1476 | # <i>cp /usr/sbin/suspend2ui_fbsplash sbin/</i> |
1476 | # <i>cp /usr/sbin/tuxoniceui_fbsplash sbin/</i> |
| 1477 | # <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-suspend2-emergence-1024x768</i> |
1477 | # <i>find . | cpio --quiet --dereference -o -H newc | gzip -9 > /boot/fbsplash-tuxonice-emergence-1024x768</i> |
| 1478 | </pre> |
1478 | </pre> |
| 1479 | |
1479 | |
| 1480 | <p> |
1480 | <p> |
| 1481 | Afterwards adjust <path>grub.conf</path> (or <path>lilo.conf</path>) so that |
1481 | Afterwards adjust <path>grub.conf</path> (or <path>lilo.conf</path>) so that |
| 1482 | your suspend2 kernel uses |
1482 | your TuxOnIce kernel uses |
| 1483 | <path>/boot/fbsplash-suspend2-emergence-1024x768</path> as initrd image. You can |
1483 | <path>/boot/fbsplash-tuxonice-emergence-1024x768</path> as initrd image. You can |
| 1484 | now test a dry run to see if everything is setup correctly. |
1484 | now test a dry run to see if everything is setup correctly. |
| 1485 | </p> |
1485 | </p> |
| 1486 | |
1486 | |
| 1487 | <pre caption="Test run for fbsplash hibernation"> |
1487 | <pre caption="Test run for fbsplash hibernation"> |
| 1488 | # <i>suspend2ui_fbsplash -t</i> |
1488 | # <i>tuxoniceui_fbsplash -t</i> |
| 1489 | </pre> |
1489 | </pre> |
| 1490 | |
1490 | |
| 1491 | <p> |
1491 | <p> |
| 1492 | Afterwards open <path>/etc/hibernate/common.conf</path> and activate the |
1492 | Afterwards open <path>/etc/hibernate/common.conf</path> and activate the |
| 1493 | fbsplash options. Execute <c>hibernate</c> and enjoy. |
1493 | fbsplash options. Execute <c>hibernate</c> and enjoy. |
| … | |
… | |
| 1625 | <e>A:</e> This happens on some systems. You have to disable |
1625 | <e>A:</e> This happens on some systems. You have to disable |
| 1626 | <c>DynamicClocks</c>. |
1626 | <c>DynamicClocks</c>. |
| 1627 | </p> |
1627 | </p> |
| 1628 | |
1628 | |
| 1629 | <p> |
1629 | <p> |
| 1630 | <e>Q:</e> I want to use suspend2, but it tells me my swap partition is too |
1630 | <e>Q:</e> I want to use TuxOnIce, but it tells me my swap partition is too |
| 1631 | small. Resizing is not an option. |
1631 | small. Resizing is not an option. |
| 1632 | </p> |
1632 | </p> |
| 1633 | |
1633 | |
| 1634 | <p> |
1634 | <p> |
| 1635 | <e>A:</e> If there is enough free space on your system, you can use the |
1635 | <e>A:</e> If there is enough free space on your system, you can use the |
| 1636 | filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it |
1636 | filewriter instead of the swapwriter. The <c>hibernate-script</c> supports it |
| 1637 | as well. More information can be found in |
1637 | as well. More information can be found in |
| 1638 | <path>/usr/src/linux/Documentation/power/suspend2.txt</path>. |
1638 | <path>/usr/src/linux/Documentation/power/tuxonice.txt</path>. |
| 1639 | </p> |
1639 | </p> |
| 1640 | |
1640 | |
| 1641 | <p> |
1641 | <p> |
| 1642 | <e>Q:</e> I just bought a brand new battery, but it only lasts for some |
1642 | <e>Q:</e> I just bought a brand new battery, but it only lasts for some |
| 1643 | minutes! What am I doing wrong? |
1643 | minutes! What am I doing wrong? |