|
TuxOnIce development has been sponsored by:
|
Next
Previous
Contents
4. Tweaking4.1 Hibernate script configuration The hibernate.conf file has several options that may help you to get hibernation
to work correctly on your specific hardware. Most of them are fairly
self-explanatory. Some often used ones are mentioned below. Running
SwitchToTextModeOn some hardware, the graphic chipset isn't properly restored by BIOS upon resume and the state memorized by the resumed kernel becomes inconsistent with that of the hardware. In this case, it may help to switch to a text console before hibernating and switch back to X only after resume. UseDummyXServerThis option may also help if you experience strange things such as 3D not working upon resume. It launches a fake xserver that should cause proper initialization of the chipset. Services (RestartServices/StopServices/StartServices)It is wise to stop before suspension all services that could be resumed in a different environment. This includes usb, pcmcia and also network services. If your suspension is aborted because a task cannot be stopped by TuxOnIce and this task corresponds to a service, you can tell the hibernate script to stop and start these services. Modules (UnloadModules/UnloadAllModules/LoadModules)In the same spirit it is wise to unload before suspension all modules that are unused. You can also force the insertion of specific modules upon resume but usually the kernel knows upon resume the modules it needs to reload. Unmounting Filesystems (Unmount) Hibernating while network filesystems or removable devices are mounted may
lead to unpredictible results. For NFS, if the mount should disappear and you
mounted with the " You can specify the mount points that must be
unused before suspension. If these can not be unmounted successfully, the
hibernate script will abort unless the Network interfaces (DownInterfaces/UpInterfaces)In the same spirit you can specify the network interfaces that must be shut down before suspension. Upon resume, you can ask the hibernate script to set some interfaces up. You can also use the keyword auto to let the network interfaces be restarted in reverse order (the default). Check for incompatible programs (IncompatiblePrograms)Some programs may be incompatible with TuxOnIce because, for instance, they directly access some hardware that ignores power management events. You may ask the hibernate script to abort hibernating if specified processes are running. Save clock on hibernate (SaveClock)It is a feature that the resumed kernel recovers its entire memory image, including the system date which therefore appears incorrect. The hibernate script calls hwclock on resume to reset the date according to the CMOS clock. You can ask the script to also save the system date to CMOS just before hibernating. Most of the time this is useless and will lead your clock becoming increasingly wrong. 4.2 Enabling debugging and tuning the system (the sysfs interface)TuxOnIce includes a /sys/power/tuxonice/ interface which allows you to tune & configure TuxOnIce according to your needs. sysfs entry descriptionsThe entries within /sys/power/tuxonice/ are:
Obtaining debugging informationTo get debugging information, you first need to have compiled TuxOnIce with the 'Compile in debugging output' option enabled. You will probably also want to compile in SysRq support (in the 'Kernel Hacking' section). Having done this, during a hibernation cycle, you can press the 0-9 keys to change the console loglevel. As you do so, TuxOnIce varies the amount of output it produces. Level 0 is the normal 'nice' display. Level 1 enables a little more detail. Levels 3+ turn off the nice display and give more detailed information. You can toggle whether TuxOnIce pauses between each step of the process by pressing the Pause or Break (useful if you have KDB enabled) keys. There are also proc entries to set initial values for these settings. You may not want to view all the information TuxOnIce prints. In this case, you can set the debug_sections parameter to control what portions of output are printed (see include/linux/suspend-debug.h in the kernel source for what each bit controls). 4.3 TuxOnIce hotkeysWhen a hibernation cycle is in progress there are a number of keys that can be used to toggle various settings.
4.4 Avoiding data lossWhile much care has gone into TuxOnIce to ensure reliability and safety of your data, there are some unusual scenarios which may lead to filesystem corruption and data loss. With a modern journalled filesystem (eg, ext3, reiserfs, xfs, jfs) a failed resume should not cause filesystem corruption, as this is the equivalent of simply losing power which should be dealt with gracefully. Other more dangerous situations are described below, with ways to workaround and avoid them: Booting non-TuxOnIce aware kernelsProblem: Booting a second kernel that does
not recognise the hibernated image in your swap partition. Or, attempting to
resume with the same kernel, but failing to put a This is very dangerous as there is no warning. For example, you have two kernels, Kernel A and Kernel B. Kernel A has TuxOnIce support, and Kernel B does not. The danger comes when hibernating with Kernel A, you then decide to boot Kernel B, that does not recognize the swap image. It ignores the "bad" swap partition and runs without it as if nothing happened (except it may run low on memory). The problem to the hibernated Kernel A is that since Kernel B mounted the filesystem r/w, it no longer matches the hibernated kernel and will be corrupted on resume. Thus, severe damage to the filesystem will result once the disk is written to by the resumed kernel. This problem has bitten unsuspecting users when, for example, a new kernel is released for their distribution and automatically installed, or if you boot a live CD (eg, Knoppix) and try to mount filesystems from there. Solution: Should this scenario occur, either the hibernated kernel must be prevented from resuming. This can be accomplished by an mkswap of the swap partition from Kernel B, or booting Kernel A with noresume. To make sure this always happens, below is a snippet from SuSE's bootscripts (courtesy of Stefan Seyfried) that you can put into an init script that is started early on boot (before swapspace is enabled). Another alternative is to modify your bootloader upon hibernating to enforce you to boot the same kernel. The hibernate script has configuration options for doing this in both GRUB and LILO.
Windows touches your FAT partitions whilst Linux is hibernatedProblem: Similar to the scenario above, if you have mounted FAT drives or partitions when hibernating and you then boot into Windows, as soon as you boot back into Linux you will probably end up corrupting your FAT drives. Solution: Unmount your FAT drives before hibernating. If you are using the Hibernate Script, you can use the following line in your hibernate.conf: UnmountFSTypes vfat fat msdos An initrd mounts your filesystem before resumingProblem: An incorrectly setup initrd can corrupt your filesystem if it tries to mount it before resuming. If your filesystem is touched in any way before resuming, your data will risk serious corruption. This even includes mounting the filesystem in read-only mode as many journalling filesystems (ext3, reiserfs, xfs) will replay the journal. Solution: Ensure your initrd is setup correctly - attempting to resume should be the first thing it tries to do after mounting /proc. If you are using an initrd, enable the "Warn if possibility of filesystem corruption" in the TuxOnIce kernel configuration. This will throw a BIG FAT WARNING if you try to resume after a filesystem has been mounted read/write. It won't catch all cases, but will probably get the most common ones. You may find this will throw spurious BIG FAT WARNINGs at your initrd being mounted read-write (which is safe in itself, as it is not linked to the hard disk). To avoid the warning here, you should mount your initrd as read-only whilst trying to resume, by putting the two mount lines below into your linuxrc script: mount -n -o remount,ro / echo 1 > /sys/power/tuxonice/do_resume mount -n -o remount,rw / Next Previous Contents Last updated: Fri, 14 Nov 2008 08:05:49 +0800 Frozen penguins image by darkmetal and adapted by Nigel Cunningham "Tuxsicle" artwork by Pierre-Philippe Coupard Copyright © 2003-2005 Bernard B |