[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

¡Esta es una revisión vieja del documento!


En proceso de traducción. Victor

Hibernación

La hibernación (también conocida como suspensión en disco) es un método utilizado para apagar una computadora y preservar el estado del sistema operativo. Una vez encendido, el sistema operativo estará en el estado exacto tal como estaba en el momento de la hibernación.

En Slackware, la hibernación funciona de forma inmediata. Sin embargo, para poder reanudar con éxito un estado de hibernación, debe configurar el cargador de arranque para que sepa dónde ubicar los datos.

Hibernar

Entornos de escritorio

KDE, XFCE y otros desktop ofrecen hibernación desde la pantalla/menú de cierre de sesión.

Gestores de ventanas ligeros

Puedes hibernar tu sistema desde la consola. Ya sea como root a través de pm-utils o D-Bus con programas adicionales como usuario regular.

pm-utils

La hibernación se realiza mediante el comando pm-hibernate .

D-Bus

Slackware ofrece dos servicios para controlar la administración de energía en sus versiones recientes. UPower y HAL. Dado que HAL está en desuso en Slackware 14.0, use HAL en versiones anteriores de Slackware (de 12.0 a 13.37), de lo contrario use UPower.

Utilice uno de estos comandos para hibernar su 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ón del Bootloader

Arranque desde LVM

LILO no admite el arranque desde LVM, por lo tanto, tiene que crear el ramdisk inicial (initrd). Necesitas uno aunque tu kernel tenga soporte incorporado para LVM.

No tiene que ajustar especialmente lilo.conf porque puede configurar todo lo relacionado en resume-related initrd.

mkinitrd -c -k <kernel-version> -f <fs_type> -m <modules_required_to_boot> -r <root_partition> -h /dev/volumegroup/swap -L

* -h configura tu hibernación /swap volumen lógico

  • -L activar LVM

LILO configuration

Next step is to make sure your lilo.conf contains following snippet

image = /boot/vmlinuz
  root = /dev/sdaX
  initrd = /boot/initrd.gz
  label = Slackware
  read-only # Partitions should be mounted read-only

If you don't use LVM, you can simply tell kernel where to resume from by adding append line:

append="resume=/dev/sdaX"

Replace /dev/sdaX with your actual swap partition.

Afterwards, run lilo to save changes.

$ lilo

Lock your computer upon resuming

You may have noticed that when your computer resumes, there is no protection to ensure no one can use your computer. As pm-hibernate must be run as root, any user that powers up your computer will be granted a root terminal! I'll show you some tricks to ensure a proper lock of the system.

Security warning: whether you are using the trick from the command-line or from an X session, don't forget to logout from all other ttys! None of them will get locked, so people issuing CTRL+ALT+F1 (ar any Fx key) upon resuming will be able to access them, rendering the lock trick totally useless!

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.

This trick may not work on fast systems, as 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.

Security warning: this “trick” will only lock the X system! If you are logged on as root in any of the other ttys, 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

Sources

 es:howtos:slackware_admin:hibernation ()