¡Açò és una versió antiga del document!
Taula de continguts
Hibernació
La hibernació (també coneguda com suspensió-a-disc) és un mètode utilitzat per a apagar un ordinador mentre es preserva l'estat del sistema operatiu. Una vegada encés, el sistema operatiu estarà en l'estat exacte en el que es trobava en el moment de la hibernació.
A Slackware, la hibernació funciona des del primer moment. Tanmateix, per a retornar amb èxit d'un estat d'hibernació, caldrà que configures el carregador de l'arrencada per a que aquest sàpiga on localitzar les dades de represa.
Hibernant
Desktop Environments
KDE, XFCE i altres entorns d'escriptori ofereixen l'hibernació des de la pantalla/menú de tancament de sessió.
Gestors de Finestres Lleugers
Pots hibernar el teu sistema des de la consola. Bé com a root via pm-utils o mitjançant D-Bus amb programes addicionals com a un usuari normal.
pm-utils
La hibernació es fa via l'ordre pm-hibernate
.
D-Bus
Slackware ofereix dos serveis per a controlar la gestió de la energia en els seus alliberament recents. UPower i HAL. Com HAL està deprecated a Slackware 14.0, utilitza HAL en alliberaments més antics d'Slackware (de la 12.0 a la 13.37), en qualsevol altre cas utilitza UPower.
Utilitza una de les ordres següents per a hibernar el teu sistema.
UPower
$ dbus-send --system --print-reply --dest="org.freedesktop.UPower" \ /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
HAL
$ dbus-send --system --print-reply --dest="org.freedesktop.Hal" \ /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Hibernate
Configuració del carregador de l'arrancada
Arrancant des de LVM
LILO no suporta l'arranc des de LVM, per tant, has de crear un disc ram inicial (initrd). En necessites un encara que el teu nucli tinga suport integrat per a LVM.
No has d'ajustar de manera especial el lilo.conf
perquè pots establir tot allò relatiu a la represa a initrd.
mkinitrd -c -k <kernel-version> -f <fs_type> -m <modules_required_to_boot> -r <root_partition> -h /dev/volumegroup/swap -L
- -h set your hibernation/swap logical volume
- -L activate LVM
LILO configuration
El següent pas és assegurar-te de que el teu lilo.conf
conté el següent fragment
image = /boot/vmlinuz root = /dev/sdaX initrd = /boot/initrd.gz label = Slackware read-only # Partitions should be mounted read-only
Si no utilitzes LVM, pots simplement dir-li al nucli des d'on reprendre afegint una línia append
:
append="resume=/dev/sdaX"
Reemplaça /dev/sdaX
amb la teua partició d'intercanvi actual.
Després d'això, executa lilo
per a salvar els canvis.
$ lilo
Bloqueja el teu ordinador en reprendre
Potser t'has adonat de que quan el teu ordinador es reprèn el seu estat, no hi ha cap protecció per a assegurar-te de que ningú puga utilitzar el teu ordinador. Com pm-hibernate
s'ha d'executar com root, qualsevol usuari que encenga el teu ordinador tindrà garantit un terminal de root! Et mostraré alguns trucs per a assegurar-te un bloqueig adequat del sistema.
With pm-utils
From the command line
If you dont have an X session open, the only way to lock your computer is to logout from your session before hibernation. You can use the following command:
pm-hibernate & logout (OR pm-hibernate & exit)
It's important to logout from every tty prior to hibernation! logout
will only log you out from the terminal from where you launched the command. Please read the warning in the following section.
logout
may not have enough time to complete. You may think that using ;
instead of &
could do the trick (as it will log out the user after resuming), but it allows the user doing a CTRL+Ctrl upon resuming, killing the logout
command.
From an X session
If you want to lock the computer prior hibernation, you can issue the following command (as root of course):
# xlock & sleep 5 ; pm-hibernate
You can also create the following script:
#!/bin/bash echo 'Hibernating in 5 seconds' xlock & sleep 5 pm-hibernate
xlock
is a command that locks your X session. Upon rebooting, you will be asked for the root password. The sleep
command may be omitted, but I think it's safer to leave it, so you are sure that xlock
has enough time to run properly. You don't have to use exit
(or logout
) at the end of the command or the script, as it has no use concerning security. You may want to use it though to automatically close the xterm on resuming.
xlock
can be killed, leaving full access to the X session.For people using init3 (no automatic X startup), remember to also logout from the tty from where you launched the X system with
startx
: hit CTRL+Z (to suspend the task), then bg
(to resume the task in the background), then CTRL+D (or logout
) to logout.
An alternate
If one is a sudoer, ie, can use sudo, then the following can also be used:
sudo /usr/sbin/pm-hibernate
Further reading
- Hibernate to encrypted swap - README_CRYPT.TXT
Sources
- Original source: http://www.slackwiki.com/Hibernate
- Otherwise rewritten by Martin Matějek (also on Slackwiki)
- Hibernate trick by zithro