From ArchWiki
Revision as of 04:49, 3 January 2011 by Louipc (talk | contribs) (Preparing the kernel)
Jump to: navigation, search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n links endTemplate:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end This is a quick start guide for installing Tuxonice (formerly suspend2), an advanced suspend/hibernate framework which supports suspending to a swap-disk or a regular file with fast LZO-compression. Visit the Tuxonice website for a full list of features.

Preparing the kernel

Tuxonice consists of a kernel patch, plus an optional user interface. Only the kernel patch is necessary, the user interface merely provides a graphical interface displayed during the hibernation/resume cycle.

You can use the kernel26-ice package in the AUR. It automatizes all the patch routines, the compilation and installation of the kernel, the regeneration of the initramfs with an appropriate hook.

You can build the package manually, see Installing packages from the AUR for more information. This is better as you maintain more control over the install process, plus its easier to make changes if you want to repeat the process.

Otherwise, you need to patch, configure and compile your own kernel, visit Kernel Compilation From Source and Kernel Compilation with ABS for instructions. The required patch can be obtained from the Tuxonice website mentioned above.

Next, you may need to run mkinitcpio, which create the ram disk for you:

 # mkinitcpio -p kernel26-ice

Next, install the hibernate-script package from the Extra repository which we will use to call Tuxonice. Hibernate-script is the default script developed by the Tuxonice development team:

# pacman -S hibernate-script

The configuration files for hibernate-script are in /etc/hibernate, we will get back to them shortly.

Setting up the bootmanager

Before your can use the suspend function, you need to add the "resume" parameter in your bootmanager, unless you have hardcoded your swap partition during the kernel configuration. The resume parameter points to the swap partition or swap file, below are the steps involved for both methods.

Suspend to swap partition

Note: As of the latest version of TuxOnIce (, adding the kernel resume parameter is no longer necessary, it will autodetect if your swap drive contains a bootable image. You only need to set the swap method appropriately. For more details, check out http://www.tuxonice.net/

Set the swap method (make sure the right partition is indicated) in /etc/hibernate/tuxonice.conf:

SuspendDevice swap:/dev/sda3

Suspend to swap file

Note: Autodetection as mentioned previously doesn't seem to work with swap files, you will still need to manually set the kernel resume paramenter.

If you use a swap file instead of a swap partition, you will need to pass the location of its header to TuxOnIce. TuxOnIce can list all available swap headers.

cat /sys/power/tuxonice/swap/headerlocations

Use the given string as-is in both /etc/hibernate/tuxonice.conf and passed to your kernel as a resume parameter.

SuspendDevice swap:/dev/sda7:0x1087070

Append the followinng to your kernel parameters:

Note: Specifying the resume device by UUID is supposed to work, but I was not able to get it to work. This may be a tuxonice or a mkinitcpio issue, YMMV. Specifying /dev/sd** should work in all cases though.

Suspend to file

For the file allocator, you will have to prepare a hibernation file. This is different from the standard swap file in that this file is ONLY used for hibernation and not as a general system swap file. The previous method is recommended as being more efficient in terms of disk space. First configure the /etc/hibernate/tuxonice.conf file, uncomment the "FilewriterLocation" option:

FilewriterLocation /suspend_file 1000

1000 is the amount of diskspace reserved for the hibernation file, in this case 1000 Megabytes. Usually an amount of 50% - 75% of your total amount of RAM will suffice.

Next, run the following command to create the hibernation file:

# hibernate --no-suspend

Take a look in /sys/power/tuxonice/resume for what to pass to your kernel. You should see something like file:/dev/hda7:0x10011f, in which case you should append "resume=file:/dev/hda7:0x10011f" as a kernel parameter in your lilo.conf file or GRUB's menu.lst.

Recreating the initramfs

If you use an initramfs, you need to add the resume hook in the HOOKS in the configuration of mkinitcpio. Additionally, if you want to speed things up by using LZO compression, add the lzo module to the MODULES array in the same file.

/etc/mkinitcpio.conf example:

HOOKS="base udev autodetect pata scsi sata resume filesystems"

Rebuild the initramfs:

# mkinitcpio -p kernel26-ice

Suspending and resuming

With hibernate-script, your preferred hibernation method can be set in the file /etc/hibernate/hibernate.conf. If you list several methods, the first one will be used. Note that hibernate can also be used with Suspend to RAM or vanilla swsusp, but this is not part of this guide.

For Tuxonice use:

TryMethod tuxonice.conf

Specific settings for Tuxonice are in /etc/hibernate/tuxonice.conf. Make sure that the following lines are uncommented and appropriately configured:

UseTuxOnIce   yes
Compressor    lzo

There are a number of additional settings and tweaks which you can set in /etc/hibernate/tuxonice.conf and /etc/hibernate/common.conf, more information about these can be found on the Tuxonice website and on the Suspend to Disk page of this wiki.

Now try Tuxonice hibernation with the following method:

# hibernate -F /etc/hibernate/tuxonice.conf

You can abort a suspend cycle if you press the escape key. If you press a capital R, you will force the system to reboot after hibernation.

If all goes well, you should be able to resume using the same Grub menu selection. If you make that option the default for Grub, you will always default to resuming if a resume image is available. Do never use a different kernel to resume than you used to suspend! If pacman updates your kernel, don't suspend before you have rebooted properly. It is recommended that you test the suspend/hibernate from a text console first and then once you have confirmed that it works try it from within X.

You can make this practice safer adding the hibernate-cleanup daemon to your DAEMONS array in /etc/rc.conf. This script will make sure that any stale image is deleted from your swap partition at boot time. This should make your system safe also in the case that you have chosen the mistaken kernel at the grub prompt. The hibernate-cleanup service is included in the hibernate-script package.

Using userui - a user interface for Tuxonice (optional)

Optionally, you can use a text or graphical (fbsplash) interface with a progress bar with tuxonice. To do this, install the tuxonice-userui package from the AUR. This package depends on the static freetype2 library that is provided by freetype2-static (also in the AUR).

In /etc/hibernate/tuxonice.conf, set the desired user interface:

ProcSetting user_interface/program /usr/sbin/tuxoniceui_text       # Text interface


ProcSetting user_interface/program /usr/sbin/tuxoniceui_fbsplash   # Graphical fbsplash interface

The fbsplash interface also needs a symlink to the fbsplash theme, like so:

# ln -s /etc/splash/arch-banner-noicons/ /etc/splash/tuxonice

Without this symlink, there will be no progress indicators during suspend/resume.

It is probably necessary to regenerate the initramfs after changing the symlink above.

The text interface may be good for debugging tuxonice, as it displays some messages. You won't see a user interface for the first few seconds of the resume process unless you add the userui hook to your mkinitcpio (before the resume hook) configuration and regenerate your initramfs, but this is also optional.

Generate initramfs:

# mkinitcpio -p kernel26-ice

To test if userui works, switch to a text console and run:

# tuxoniceui_text --test

For the graphical interface run:

# tuxoniceui_fbsplash --test


  • The Tuxonice website and Tuxonice wiki are excellent sources of documentation.
  • More general information about suspend/hibernate with hibernate-script can be found on the Suspend to Disk page of this wiki. This also covers some advanced topics like problems with specific hardware and configurations.
  • Another good source of information is the Gentoo wiki