Saturday, March 26, 2011

How to Install Tuxonice in Ubuntu

“TuxOnIce is most easily described as the Linux equivalent of Windows’ hibernate functionality, but better. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off. No documents need to be reloaded or applications reopened and the process is much faster than a normal shutdown and start up.” - tuxonice.net



Tuxonice is an alternative way to hibernate your machine than the standard ubuntu power manager way. It generally claims to be more configurable and flexible than the standard method, with faster hibernate and resume times.

Original article:http://lists.tuxonice.net/lurker/message/20090409.181125.d20e0bbe.en.html

Add the following PPA to your sources list

    deb http://ppa.launchpad.net/tuxonice/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/tuxonice/ppa/ubuntu jaunty main

This repository is signed with 1024R/DEC8FAAC OpenPGP key

Open a terminal and enter the following:

gpg --keyserver keyserver.ubuntu.com –recv DEC8FAAC

gpg --export --armor DEC8FAAC | sudo apt-key add - && sudo apt-get update

—————————————————————————————————-
Relevant files for Ubuntu Jaunty

https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-headers-2.6.28-13-generic_2.6.28-13.43+tuxonice2_amd64.deb

https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-headers-2.6.28-13-

generic_2.6.28-13.43+tuxonice2_i386.deb

https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-image-2.6.28-13-generic_2.6.28-

13.43+tuxonice2_amd64.deb

https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-image-2.6.28-13-generic_2.6.28-

13.43+tuxonice2_i386.deb

https://launchpad.net/~tuxonice/+archive/ppa/+files/tuxonice-userui_1.0-

1~ppa2~jaunty1_amd64.deb

https://launchpad.net/~tuxonice/+archive/ppa/+files/tuxonice-userui_1.0-

1~ppa2~jaunty1_i386.deb

http://www.tuxonice.net/downloads/all/hibernate-script-2.0.tar.gz

files for intrepid can be found here: https://launchpad.net/~tuxonice/+archive/ppa

—————————————————————————————————-

Install the relevant files for your architecture (choose either the i386 or amd64 files only).

Reboot once the new kernel has been installed.

Extract hibernate-script-2.0.tar.gz somewhere

open a terminal in the directory created and run ./install.sh

sudo -i to switch to root.

apt-get install sysfsutils

gedit /etc/sysfs.conf

Copy and past the text below into the file, then save and close.
—————————————————————————————————-
# /etc/sysfs.conf - Configuration file for setting sysfs attributes.
#
# The sysfs mount directory is automatically prepended to the attribute paths.
#
# Syntax:
# attribute = value
# mode attribute = 0600 # (any valid argument for chmod)
# owner attribute = root:wheel # (any valid argument for chown)
#
# Examples:
#
# Always use the powersave CPU frequency governor
# devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave
#
# Use userspace CPU frequency governor and set initial speed
# devices/system/cpu/cpu0/cpufreq/scaling_governor = userspace
# devices/system/cpu/cpu0/cpufreq/scaling_setspeed = 600000
#
# Set permissions of suspend control file
# mode power/state = 0660
# owner power/state = root:power
power/tuxonice/user_interface/program = /usr/lib/tuxoniceuserui/tuxoniceui_usplash
—————————————————————————————————-
gedit /usr/share/initramfs-tools/hooks/tuxonice_userui
Copy and past the text below into the file, then save and close.
—————————————————————————————————-
#!/bin/sh
# -*- shell-script -*-
PREREQ=”"
prereqs()
{
echo “$PREREQ”
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac

. /usr/share/initramfs-tools/hook-functions

TUXONICE_ENABLED=/sys/power/tuxonice/user_interface/enabled

# Don’t do anything if the kernel does not support tuxonice_userui,
# nor the module is there
if [ -f ${TUXONICE_ENABLED} ]; then
if [ `cat ${TUXONICE_ENABLED}` = 0 ]; then
echo “TuxOnIce user interface is disabled, skippingxn--”
exit 0
fi
elif [ ! -f ${MODULESDIR}/kernel/power/tuxonice_userui.ko ]; then
echo “This kernel does not seem to support TuxOnIce user interface, skippingxn--”
exit 0
fi
# Add the module and its dependencies and load it automatically if it
# exists

force_load tuxonice_userui

TUXONICEDIR=/usr/lib/tuxonice-userui

mkdir -p ${DESTDIR}${TUXONICEDIR}

copy_exec ${TUXONICEDIR}/tuxoniceui_text ${TUXONICEDIR}
copy_exec ${TUXONICEDIR}/tuxoniceui_fbsplash ${TUXONICEDIR}

# The following file does not exist on ia64 as usplash is not
# available on this architecture
if [ -x ${TUXONICEDIR}/tuxoniceui_usplash ]; then
copy_exec ${TUXONICEDIR}/tuxoniceui_usplash ${TUXONICEDIR}
fi
—————————————————————————————————-
gedit /usr/share/initramfs-tools/modules.d/lzo
Copy and past the text below into the file, then save and close.
—————————————————————————————————-

lzo

—————————————————————————————————-
gedit /usr/share/initramfs-tools/scripts/local-premount/tuxonice_do_resume
Copy and past the text below into the file, then save and close.
—————————————————————————————————-

#!/bin/sh
PREREQ=”"
prereqs()
{
echo “$PREREQ”
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;

esac

if [ -d /sys/power/tuxonice ]; then
echo > /sys/power/tuxonice/do_resume
fi
—————————————————————————————————-
chmod 644 /etc/sysfs.conf

chmod 755 /usr/share/initramfs-tools/hooks/tuxonice_userui

chmod 644 /usr/share/initramfs-tools/modules.d/lzo

chmod 755 /usr/share/initramfs-tools/scripts/local-premount/tuxonice_do_resume

update-initramfs -c -k 2.6.28-13-generic

gedit /etc/hibernate/tuxonice.conf

find the line that says “Compressor lzf” and change to “Compressor lzo”

if there is no SuspendDevice option, create one as below, changing the device to your own swap drive location (on mine it is sda7).

## useful for initrd usage:
SuspendDevice swap:/dev/sda7

You can also use the filewriter option described below, however I have not been able to get this working on my system yet so can’t provide more detailed instructions.

“For the file allocator, you should first prepare your hibernation file – this can be done by configuring your hibernate.conf file with the “FilewriterLocation” option, and running hibernate --no-suspend. Then 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 parameterin your lilo.conf file or GRUB’s menu.lst.” – http://www.tuxonice.net/HOWTO-2.html”

If the line below is not there put it in.

ProcSetting userui_program /usr/lib/tuxonice-userui/tuxoniceui_usplash

gedit /boot/grub/menu.lst

add resume=swap:/dev/sda7 to the end of the new kernel line. (changing the device to your swap drive, or hibernation file)

add resume=swap:/dev/sda7 noresume to the recovery option below the above entry.This is useful in case something goes wrong, you can use the recovery option to bypass resuming.

reboot. hibernate. resume.

If all went well your system should resume to the same state you were in before hibernation.

Source : http://www.ubuntugeek.com/how-to-install-tuxonice-in-ubuntu.html

No comments:

Post a Comment