TuxOnIce in * ubuntu 9.04

    What is TuxOnIce? This is a project previously called suspend2, trying to make a fast and stable hibernate for Linux.
    What is hibernate? If you do not know what it is, then hibernate = sleep mode (Win XP) = hibernation (gygy) (Vista). This is the recording of the contents of physical memory on the hard drive and the complete shutdown of the computer, after which you can start the system and continue working.
    More information about Tux On Ice can be found on the official website.

    In this article I want to tell how to make TuxOnIce work on the currently popular Ubuntu distribution (with its modifications, of course).
    It should be noted that out of the box in Ubunt hibernate works (just suspend-to-disk), while it is quite stable. It describes how to start using the more fancy TuxOnIce instead, the main profit from which is to speed up the process and the ability to monitor what is happening.

    Disclaimer: If you do not understand what is happening at each step, do not. Nobody needs someone else's problems because of thoughtless copy-paste.

    Let's get started.

    First, we need a kernel with the patch applied. There is a correct path (rebuilding) and a simple one (installation from the repository). We leave the right for gentushnikami and other not quite normal people. (By the way, setting up TuxOnIce in Gentoo is easier).

    We register the repository with the tuxonice-enabled kernel, add the key, update:
    $ sudo -i
    # echo deb http:\/\/ppa.launchpad.net/tuxonice/ppa/ubuntu jaunty main >> /etc/apt/sources.list
    # gpg --keyserver hkp://subkeys.pgp.net --recv-keys DAC45EC9DEC8FAAC
    # gpg --export DAC45EC9DEC8FAAC|apt-key add -
    # apt-get update

    We update, the new kernel should be delivered from the freshly registered repository. At the same time, we set up auxiliary things: We reboot, make sure that the kernel is working. Next, we tell the kernel (in fact, tuxonice), from where it (o) will try to continue working. We feed the kernel the resume = / dev / swap parameter (partition with swap) After that, we make and make sure that in the config all non-recovery kernels have found such an option. The same swap partition must be fed to the hibernate script. To do this, set the SuspendDevice parameter in the /etc/hibernate/suspend2.conf file.
    # apt-get dist-upgrade
    # apt-get install tuxonice-userui

    $ uname -rv
    2.6.28-12-generic #44+tuxonice2-Ubuntu SMP Sun Apr 26 23:28:12 UTC 2009

    $ grep defoptions /boot/grub/menu.lst
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash resume=/dev/sda5

    # update-grub

    Now the fun part. If you try to leave in hibernate, and then recover from it, then you may be waiting for disappointment. TuxOnIce by default compresses the contents of memory with the LZF algorithm, for which it needs the corresponding kernel module. In ubunt from the box, I did not find this :)
    There are two solutions : do not use compression or use, for example, LZO and load the module until it resumes. Since the first way can lead to a lack of space when freezing the system, we will go the second way.
    We open the same /etc/hibernate/suspend2.conf and edit the Compressor parameter - instead of lzf we write lzo.
    So, when the kernel takes off, TuxOnIce tries to resume the system from the specified section (swap). But he cannot do this, since the image is compressed by an algorithm that was inaccessible at that time. Next, initrd is mounted and the download goes in its usual way.
    Our task is to make such an initrd, init in which it will load the lzo module and issue a command to retry the recovery.
    # echo lzo >> /etc/initramfs-tools/modules
    So we added the module to the initrd build list. Next is a script to restore. It should turn out like this: Do not forget to give everyone the rights to execute this file: Now we rebuild initrd (command update-initramfs -u). We try: if it does not go well with GUE, on behalf of the root we execute the hibernate command and read what it swears. It should look something like this:
    # cat /etc/initramfs-tools/scripts/init-top/00resume
    case $1 in
    exit 0

    modprobe lzo

    if [ -d /sys/power/tuxonice ]; then
    echo > /sys/power/tuxonice/do_resume

    chmod +x /etc/initramfs-tools/scripts/init-top/00resume

    As a result, we have a laptop (or not a laptop, but I do not see the point in hibernate in other cases) with fashionable fast hibernate.

    Unfortunately, some drivers are not very friendly with this mode, the most dangerous of them are video. Fresh intel and nvidia (180+) can certainly work, I won’t say anything about ATI and other exotic.
    In the /etc/hibernate/common.conf file, you can configure a variety of tweaks, from muffling to restarting services and removing / loading drivers.
    Theoretically, you can screw the graphical interface to display the status, but these are separate dances, from which, IMHO, there are more possible glitches than real benefits.

    Also popular now: