⬆️ ⬇️

TuxOnIce in * ubuntu 9.04

What is TuxOnIce? This project, previously known as suspend2, is 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 the physical memory on the hard disk and the complete shutdown of the computer, after which you can start the system and continue working.

Read more about Tux On Ice on the official site.



In this article I want to tell you how to make TuxOnIce work on the currently popular Ubuntu distribution (with its modifications, of course).

It should be noted that hibernate works out of the box in Ubunt (just suspend-to-disk), and is quite stable. Here it is described how, instead of it, to start using a more functional TuxOnIce, the main profit from which is the acceleration of the process and the ability to observe what is happening.





Disclaimer: If you do not understand what is happening at each step - do not do it. Nobody needs other people's problems because of the thoughtless copy-paste.

')

Let's get started



First we need a kernel with a patch superimposed. There is a correct (reassembly) and simple path (installation from the repository). Let's leave the right ones to the gents and the rest to not quite normal people. (By the way, installing TuxOnIce is easier in Gentoo).



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




Update, new kernel should be supplied from the newly registered repository. At the same time we put auxiliary things:

# apt-get dist-upgrade

# apt-get install tuxonice-userui




Reboot, make sure the kernel is working.

$ uname -rv

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




Then we tell the kernel (in fact, tuxonice), from where it (o) will try to continue working. Feed the kernel the parameter resume = / dev / swap (partition with swap)

$ grep defoptions /boot/grub/menu.lst

## eg defoptions=vga=791 resume=/dev/hda5

# defoptions=quiet splash resume=/dev/sda5


After this, do # update-grub and make sure that in the config all non-recovery kernels have found such an option.



The same partition with the swap must be fed to the hibernate script. To do this, set the SuspendDevice parameter in the /etc/hibernate/suspend2.conf file.



Now the fun part. If you try to leave in hibernate, and then recover from it, then you may be disappointed. TuxOnIce compresses the contents of the memory with the LZF algorithm by default, for which it needs the appropriate kernel module. In ubunt out of the box I did not find this :)

There are two ways out - do not use compression or use, for example, LZO and load the module before resuming. Since the first path can lead to a lack of space when the system is frozen, 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, during the take-off of the kernel, TuxOnIce tries to restart the system from the specified partition (swap). But it cannot do this, because the image is compressed with an algorithm that is not available at that time. Next, the initrd is mounted and the boot goes its normal way.

Our task is to make such an initrd, init in which will load the lzo module and give the command to retry the recovery.

# echo lzo >> /etc/initramfs-tools/modules

So we added the module to the initrd build list. Next - a script to restore. It should turn out like this:

# cat /etc/initramfs-tools/scripts/init-top/00resume

#!/bin/sh

case $1 in

prereqs)

exit 0

;;

esac



modprobe lzo



if [ -d /sys/power/tuxonice ]; then

echo > /sys/power/tuxonice/do_resume

fi


Do not forget to give everyone the right to execute this file: chmod +x /etc/initramfs-tools/scripts/init-top/00resume



Now reassemble the initrd (update-initramfs -u command).



We try: if it doesn’t work with GUE, we execute the hibernate command on behalf of the root and read what it swears at.



It should look like this:





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. Of course, fresh intel and nvidia (180+) can work, I will not say anything about ATI and other exotics.

In the /etc/hibernate/common.conf file, you can configure a variety of tweaks, from damping sound to restarting services and removing / loading drivers.

Theoretically, you can fasten a graphical interface to display the status, but these are separate dances, from which, IMHO, there are more possible glitches than real benefits.

Source: https://habr.com/ru/post/60401/



All Articles