Recently, I wanted to use such a convenient feature in Ubuntu as hibernation, but instead of the desired sleep mode I received only a tightly hung system. When trying to figure out, it was only possible to find out that the problem is far from unique and “will be fixed in the foreseeable future.” After a brief googling and reading the forums, it was decided to use the capabilities of the s2disk application from the uswsusp package, and use it as transparently as possible ...
To begin, we will need a swap section (during the experiments with the swap file we could not get the desired result),
find out if there is such a section and where we can look for it like this:
swapon -s
in the output of which we will see something like:
/ dev / sda2 partition 10482404 181280 -
If the swap partition is found successfully, proceed to the installation:
sudo apt-get install uswsusp
As practice has shown, uswsusp wonderfully determines the parameters of the environment, but it will be useful to make sure that the settings are correct. For this, we open the
/etc/uswsusp.conf config with root privileges with our favorite editor and carefully look at:
- the “resume device” parameter, should point to the swap-section (which we saw at the very beginning)
- “shutdown method” parameter, specifies the action taken after recording a snapshot, by default of “platform”
Actually there is nothing more to customize, all the default settings are set as it should. Now is the time to test performance:
sudo s2disk
If there were no surprises and the computer successfully “fell asleep”, then skip the next step. I also had to face a reboot after taking a snapshot. As a result of reading the mana, we managed to find out that if we set any non-reserved value, then we force the power off, which we will do by specifying any value you like in the
/etc/uswsusp.conf config, for example:
shutdown method = poweroff
Now let's get to the most important thing - let Gnome Power Manager use the already configured s2disk instead of the built-in hibernation function. To do this, we need to edit the script at
/ usr / lib / hal / scripts / hal-system-power-hibernate and bring it to the following form:
#! / bin / sh
s2disk
Now your darling will peacefully “fall asleep” when you press the “Sleep mode” button in the computer shutdown window with all conveniences: fading the screen and fading the screen when waking up =)
PS We take into account the comments - all of the above was done on the workstation with 1526 MB of RAM. The size of the swap partition was first 310Mb, then 10GB.