How to Install Tuxonice in Ubuntu
Sponsored Link
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, skipping..."
exit 0
fi
elif [ ! -f ${MODULESDIR}/kernel/power/tuxonice_userui.ko ]; then
echo "This kernel does not seem to support TuxOnIce user interface, skipping..."
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.
The problem that you were having. is the same as i have been having. the move command in this tutorial creates /etc/etc/* and /usr/usr/* try using cp -rv usr/* /usr/ and cp -rv etc/* /etc/ instead.
hi there,
your commands
“gpg
--
export--
armorDEC8FAAC | sudo apt-key add – && sudo apt-get update”doesnt work,
it works when I type
“gpg
--
armor--
export DEC8FAAC | sudo apt-key add – && sudo apt-get update”thanks!
Doesn’t the .30 release of the Kernel have better support for hibernation and remove ?
I just wonder if it better to upgrade the Kernel than use Tuxnoice. Any thoughts on this ?
This doesn’t seem like a Noob friendly task. Does anyone know of a more “hold you by the hand” tutorial? Or is my ignorance of the processes involved in doing this, a clear indication that I should perhaps wait until I pick up a few more skills?
not sure how much simpler I could make this, it is mostly cut and paste stuff.
Most of the work is already done in the patched kernel from the PPA. The rest is just some simple commands to get initramfs-tools to use tuxonice on resume.
If there is something specific you would like to know just ask.
I don’t know how tuxonice compares with hibernation in the latest kernels because I have been using it ever since 1 of the kernels refused to let me hibernate or suspend. From my experience with earlier kernels, tuxonice is much faster and also gives you feeback about what it is doing.
Hello,
I’d like to make tuxonice working on my fresh Jaunty install. However, I can’t compile NVIDIA drivers – I always get a prompt that I need the kernel source tree to compile them, but how am I supposed to install source tree for 2.6.28-13? From PPA I can only get sources for 2.6.28-14 and I did it along with installing headers and image of 2.6.28-14 but I keep receiving the prompt!
best try the tuxonice mailing list
http://www.tuxonice.net/lists.html
I’ve never compiled nvidia drivers so cant offer assistance
Appreciate the instructions. I haven’t tested this out yet, but there do seem to be some errors in your code as posted. I’m not sure about the gpg instructions, but copy and paste ends up with some characters being wrong. Same with the scripts, where it looks to me like smart quotes got in there that shouldn’t be. I could be totally wrong, but with just copying and pasting, I was getting errors. I made selected changes until I didn’t get errors, so I’ll see how it goes.
Thanks for the tutorial but I cant even get the package installed I set the sources and imported keys everything works fine, like in every other ppa but in synaptic manager there is no tuxonice (except userui) If it is of any use my kernel is Linux 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686 GNU/Linux
try installing directly from the ppa
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-libc-dev_2.6.28-14.45+tuxonice1_amd64.deb
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-doc-2.6.28_2.6.28-14.45+tuxonice1_all.deb (3.5 MiB)
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-headers-2.6.28-14-generic_2.6.28-14.45+tuxonice1_amd64.deb (684.3 KiB)
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-headers-2.6.28-14-server_2.6.28-14.45+tuxonice1_amd64.deb (684.3 KiB)
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-headers-2.6.28-14_2.6.28-14.45+tuxonice1_all.deb (8.5 MiB)
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-image-2.6.28-14-generic_2.6.28-14.45+tuxonice1_amd64.deb (23.3 MiB)
https://launchpad.net/~tuxonice/+archive/ppa/+files/linux-libc-dev_2.6.28-14.45+tuxonice1_amd64.deb (759.5 KiB)
/usr/share/initramfs-tools/hooks/tuxonice_userui: 1: Syntax error: Unterminated quoted string
when I do
update-initramfs -c -k 2.6.28-13-generic
Isn’t there a <code> block one can use to get compatible “:s and -:s?
Like so:
echo "this will actually be copy pasteable"
Heh, Guess there is.
Then, I have a task for the author of this thing:
Please put everything that is to be copied into <code>-blocks!
Do like this everywhere:
Instead of just typing
echo "$PREREQ"
,which generates the as far as sh is concerned illegible
echo “$PREREQ”,
type <code>
echo "$PREREQ"
</code>,which produces
echo "$PREREQ"
,which is copy pasteable even for the most nooby of the readers. Copy-paste is according to me heavily preferrable over copy-paste-and-edit-everything.
Other improveable things I noticed while following this tutorial:
The direct links to the deb-files are broken.
The test
elif [ ! -f ${MODULESDIR}/kernel/power/tuxonice_userui.ko ]
won’t succeed for me eventhough I use the tuxonice-patched kernels. Ignoring this test, I now have a hibernateable system, albeit maybe only non-graphically. Is there a reason for making this test here?Anyways, I now have a hibernateable system, and am moving on to the next step of patching my nvidia drivers. Thanks a lot for the tutorial!
This how to helped me to setup the tuxonice but it took me 2 days of trouble. I would like to first thank the author and suggest him to put more description on the grub part for example mention to run the update grub at the final stage and put a menu.lst sample.
Just i would like to ask from where i have to start to answer this question. ,
please add repo for Lucid Lynx
coff_coff, you’ll be please to know I’ve just made the git tree for it. I try not to jump in too early, because they keep rebasing the kernel (or have done so in the past), which makes it a pain to track. There should be PPAs available within a day or two.
Thanks for this howto!
I am trying this in Meerkat. Do i need to change configuration for better experience? So far i have installed tuxonice-userui linux-generic-tuxonice linux-headers-generic-tuxonice from ppa:tuxonice/ppa and its working great.
I’ve also just installed those packages as Donnie’s said from https://launchpad.net/~tuxonice/+archive/ppa and everything’s working, thanks!
I’m wondering if you (or anyone else) has successfully got the FileWriter option working? I am getting this error on running hibernate:
ABORTING: resume is not setup correctly. Unless you have setup your bootloader correctly, resuming will most likely fail. To correct this, add “resume=UUID=3ae642dce2cb484f8f66912137190eb6:0x658000” to your kernel command line in your LILO or GRUB configuration file and reboot.
hibernate: Aborting.
Of course, I’ve added the specified string to /boot/grub/menu.lst, but after rebooting, I get the same message. Any ideas?
Thanks!
The hibernate script will be looking at what’s in /sys/power/tuxonice/resume and /sys/power/tuxonice/file/target. These are in turn set by the following options in /etc/hibernate/tuxonice.conf:
## For filewriter:
# FilewriterLocation /suspend_file 1000
# VerifyFilewriterResume2 yes
If I recall correctly, you should only need to uncomment the FilewriterLocation entry, but I’m not sure I do.
Anyway, the way to ensure your resume= is correct is (as root):
echo /path/to/filewriter/file > /sys/power/tuxonice/file/target
cat /sys/power/tuxonice/resume
If that still doesn’t get you going, please email the TuxOnIce users list – we have a good number of people there who’ll be able to help.
Nigel
Thanks, really useful using on Ubuntu 11.10.
In my case, i download a bare 3.1 kernel and apply the -pf patchset with TuxOnIce 3.2, After created /suspend file has our TuxOnIce guru Nigel says. It hibernate ok, but on resume i got the error: “Compress_read returned -22”
“Breaking out of I/O loop because of result code -22.”
Fixed it compiling AHCI static in the kernel, with my SATA drivers. It avoids the error:
“TuxOnIce: Can’t translate “UUID=xxxx”
Setting BFQ as default block I/O scheduler, with the lzo module static and at last, put the line:
echo 1 > /sys/power/tuxonice/do_resume
in the file:
/usr/share/initramfs-tools/init
after the lines that mount sysfs and procfs.
Recreate initramfs and adjust grub with resume=UUID=
No userui because i do not install any package, just compiled a new kernel and used the hibernate-script-2.0 from git.
That’s it, once again thanks !