Hibernation with SuSE 9.0, Kernel 2.6.3 and Bootsplash
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By hyperlink1uk at 2004-03-11 13:16
Hi ALL
I decided to write this howto, to stop people from running into the problems I did. In this howto I will explain how to patch your kernel for:
SuSE 9.0
Running Kernel 2.6.3
With Hibernation
and Bootsplash
Then how to configure hibernation and bootsplash and how to get them both to work with each other
Patching The kernel
Hibernation patches
I know the 2.6 kernels have a swsusp patch but it did not work for me.
I used the patches available at http://swsusp.sourceforge.net
Download the new 2.6.3 kernel from kernel.org and extract to /usr/src
Ok, I had a nightmare with ALSA stopping my computer coming out of hibernation. Unless you really need alsa, compile the driver for your sound card for the open sound system.
Compiling the Kernel
Type the following commands to compile the kernel and modules
mkproper
make bzImage
make modules
make modules_install
You have now compiled your kernel and installed the modules, install your kernel and System.map file as follows:
Type mkinitrd -k bzImage-2.6.3 -i initrd.img-2.6.3
If in the output you see a line indicating a bootsplash image
has been put into your initrd, skip the next part, if not try the following:
Configuring mkinitrd
<Warning this bit can be dangerous, although it worked fine on my system>
If like me, mkinitrd did not put your image files into the initrd, try this:
I edited mkinitrd as follows to get it to compile in my bootimage.
open /sbin/mkinitrd in your fav txt editor and find this code :
Code:
if [ -n "$splash" -a -x /sbin/splash.bin ]; then
if [ -f /etc/sysconfig/bootsplash ]; then
. /etc/sysconfig/bootsplash
fi
bootsplash_picture_dir="$root_dir/etc/bootsplash/themes/$THEME"
echo -ne "Bootsplash:\t"
if [ -d $bootsplash_picture_dir -o -L $bootsplash_picture_dir ]; then
for size in ${splash//,/ }; do
bootsplash_picture="$bootsplash_picture_dir/images/bootsplash-$size.jpg"
cfgname="$bootsplash_picture_dir/config/bootsplash-$size.cfg"
if [ ! -r $cfgname ] ; then
echo "disabled for resolution $size"
elif [ ! -r $bootsplash_picture ] ; then
echo "no image for resolution $size"
else
echo "$THEME ($size)"
/sbin/splash.bin -s -f $cfgname >> $initrd_image
fi
done
else
echo "no theme selected"
Replace this code with the following:
Code:
if [ -n "$splash" -a -x /sbin/splash.bin ]; then
if [ -f /etc/sysconfig/bootsplash ]; then
. /etc/sysconfig/bootsplash
fi
bootsplash_picture_dir="$root_dir/etc/bootsplash/themes/SuSE"
echo -ne "Bootsplash:\t"
if [ -d $bootsplash_picture_dir -o -L $bootsplash_picture_dir ]; then
for size in ${splash//,/ }; do
bootsplash_picture="$bootsplash_picture_dir/images/bootsplash-$size.jpg"
cfgname="$bootsplash_picture_dir/config/bootsplash-$size.cfg"
if [ ! -r $cfgname ] ; then
echo "Enabling BootSplash:Applying 2.6.3 Fix: Bootsplash forced"
/sbin/splash.bin -s -f /etc/bootsplash/themes/SuSE/config/bootsplash-1024x768.cfg >> /boot/initrd.img-2.6.3
elif [ ! -r $bootsplash_picture ] ; then
echo "no image for resolution $size"
else
/sbin/splash.bin -s -f /etc/bootsplash/themes/SuSE/config/bootsplash-1024x768.cfg >> $initrd_image
fi
done
else
echo "no theme selected"
Change "bootsplash-1024x768.cfg" in above code to the file for your resolution
Now try again to make your initrd
Type the following:
mkinitrd -k bzImage-2.6.3 -i initrd.img-2.6.3
You should see a line saying ?a bootsplash has been put in by overriding the built-in settings?
Updating Grub
Update /boot/grub/menu.lst with the new bzImage-2.6.3 kernel and initrd.img-2.6.3
If all went well then carry on to the next part, if not go back and check you did everything right.
HIBERNATION SETUP
The hibernation software is good, but not all of your system drivers will get restored and some services need restarting. For me, and I guess most people, the following will work:
WARNING
If you are using the nvidia binary driver switch back to the nv open source driver by editing the line
driver=nvidia to driver=nv
in /etc/X11/XF86Config
See the end of the Howto for more information about the problems with the binary driver.
#-*-mode: sh-*-
# Configuration of software suspension
#
# If your graphic device is not able to return properly from suspend
# you can switch to textconsole before suspend and return to your
# X-console after resume.
# If you use an nvidia card, you can set this to nvidia. This
# will try to restore your 3D upon resume. This trick may be useful
# for other cards.
# Default: "no"
SWSUSP_LEAVE_X_BEFORE_SUSPEND="no"
# Some services (e.g. network) may cause some hangs if they are not
# stopped before a suspend/resume cycle. You can set
# SWSUSP_RESTART_SERVICES to a list of services to stop before suspend
# and automatically restart after resume.
# If suspending results in killing some application because of lack
# of memory, you may also add here some of your launched services,
# so as to save memory. Good candidates are httpd, nfsserver, sendmail, etc.
# Default: " postfix alsasound gpm xntpd nfs network"
SWSUSP_RESTART_SERVICES=" postfix gpm network kbd acpid"
# Some services may need to be stopped before a suspend/resume cycle.
# You can set STOP_SERVICES_BEFORE_SUSPEND to a list of services to stop
# before suspend. These services will NOT automatically be restarted after
# the resume, use SWSUSP_RESTART_SERVICES instead if you want this
# behaviour.
# Default: ""
SWSUSP_STOP_SERVICES_BEFORE_SUSPEND="alsasound"
# Conversely, you can set START_SERVICES_AFTER_RESUME to a list
# of services to start after resuming.
# Default: ""
SWSUSP_START_SERVICES_AFTER_RESUME=""
# Those are programs that prevent from suspending. If they are
# running and --force or --kill option aren't used, suspension
# is aborted.
# Default: ""
SWSUSP_NON_COMPATIBLE_PROGS=""
# You can ask to killall these applications before suspend.
# Default: none
SWSUSP_STOP_PROGS_BEFORE_SUSPEND=""
# You can ask to run some applications before suspend using this variable.
# For instance, it may stop your VPN.
# Default: none
SWSUSP_START_PROGS_BEFORE_SUSPEND=""
# You can ask to run some applications after resume using this variable.
# For instance, it may restart your ADSL connection.
# Default: none
SWSUSP_START_PROGS_AFTER_RESUME="/root/run"
# If the following mount points cannot be unmounted,
# then suspension is aborted unless --force or --kill
# option is used on command line
# Default: "/floppy /cdrom /var/adm/mount"
SWSUSP_UMOUNTS="/floppy /cdrom /var/adm/mount"
# These mount points should be mounted after suspend
# They should appear in /etc/fstab
# Default: none
SWSUSP_REMOUNTS=""
# If the following interfaces cannot be stopped,
# then suspension is aborted unless --force or --kill
# option is used on command line
# Default: "eth0"
SWSUSP_DOWNIFS="eth0"
# These interfaces should be started after suspend
# With "auto" the interfaces stopped before suspension
# will be started in reverse order.
# Default: "auto"
SWSUSP_UPIFS="auto"
# Some modules should be unloaded before a suspend/resume cycle. You
# can set UNLOAD_MODULES_BEFORE_SUSPEND to "yes" if you want
# unused modules to be removed from kernel space before suspend.
# This will be done after stopping services.
# With "no", nothing will be done before suspension.
# With "auto", it only does "rmmod -a" to clean modules
# which are marked "(autoclean)" in lsmod.
#
# Default: "yes"
SWSUSP_UNLOAD_MODULES_BEFORE_SUSPEND="yes"
# These modules should be unloaded after stopping services but
# before suspending.
# Default:
SWSUSP_REMOVEMODS=""
# These modules should be loaded after suspend
# Gentoo users can use "modules.autoload" here to read modules out of
# /etc/modules.autoload (this requires other Gentoo-specific scripts)
# Default:
SWSUSP_INSERTMODS="es1371"
# Use SWSUSP_FORCE_SUSPEND_MODE to reset the behaviour of
# suspension. If empty, this let the suspension
# behaviour unchanged. Otherwise, these values will cause:
# echo "0 $SWSUSP_FORCE_SUSPEND_MODE" > /proc/swsusp/all_settings"
#
# This is simply a quick way of setting your favourite swsusp
# parameters. To determine the value of SWSUSP_FORCE_SUSPEND_MODE,
# tweak the files in /proc/swsusp to your heart's content, and then
# use . The value of
# SWSUSP_FORCE_SUSPEND_MODE will be all but the first number. eg,
# # cat /proc/swsusp/all_settings
# 0 2048 0 100
# means you should have SWSUSP_FORCE_SUSPEND_MODE="2048 0 100"
#
# Alternatively, you can use the keyword "acpi" to use the
# /proc/acpi/sleep interface in place of /proc/swsusp/all_settings
#
# Default: "0", i.e. halt, escape disabled. extra settings are untouched
SWSUSP_FORCE_SUSPEND_MODE="0"
# If you have problems with hardware clock drift amplified by
# suspension, try to set SAVE_CLOCK_ON_SUSPEND to "yes". The
# kerneltime will being saved before suspending. If you have
# network access, best is to set this variable to yes and add
# xntpd in services to start/stop below. If you haven't such
# a service permanently available, it is better to leave it
# to no, so that hardware clock remains as a reference for
# the system.
# Default: "no"
SWSUSP_SAVE_CLOCK_ON_SUSPEND="no"
# On some hardware, the power is cut off before the disk has
# flushed his own hardware cache. Insert the device of your
# swap partition here (e.g. /dev/hda) if you want to issue
# hdparm -W 0 <device>
# before suspension.
# Default: none
SWSUSP_DISABLE_HW_DISK_CACHE=""
# This specifies the VT on which logging will occur if --silent
# is not enabled. This is also the VT which will be switched to
# if SWSUSP_LEAVE_X_BEFORE_SUSPEND is enabled.
# Default: 9
SWSUSP_VT="9"
Replace es1371 with the OSS driver for your sound card
To bring up all the modules and services that you need, you could add them to suspend.conf, however I do it with a simple bash script.
Make the file executable. This is normally done by right clicking the file, going to properties, and selecting the advanced tab in KDE. You need to replace es1371 with the module for your sound card. Also ext3 should be replaced with the filesystem on your root device, i.e. ext2 etc. The last one; boot.idedma, can freeze up, this is why I run this process after I have come out of hibernation. Beware, on my system, failure to reactivate boot.idedma results in system slow down and crashes.
<----Optional Needed On OSS Systems---->
Ok, if you took my advice and switched to the OSS sound server, you need to apply this fix. I have only just discovered this, it could be a problem with my sound card or a general problem. Anyway, this worked for me.
Upon resume, OSS can play DVDs and CDs but as soon as you try to play a local file it locks up with an error about snd-pcm.
In order to fix this problem you need to rmmod a number of modules, as normal this can be configured within the suspend.conf file. However, I prefer to have a separate file that does this.
You need to change es1371 to match the oss sound module for your sound card, you might not need the ac97-codec as well but it does not hurt to have it there anyway. Also replace ?username? with your username.
Save this file in the normal way (Press esc, then type :wq and press enter)
Now login as a normal user and type:
mkdir .soundfix
then:
vi run
add the following to that file
/code]
sudo /sbin/rmmod es1371
sudo /sbin/rmmod snd-pcm-oss
Again you need to replace es1371 with the module for your sound card for OSS
Ok that's it, as root type /usr/local/sbin/hibernate
Your computer should then hibernate and shutdown
Boot back up into your new kernel
****WARNING: Make sure you boot into your new swsusp enabled kernel, otherwise you could screw your whole filesystem up.**************************************************************
If you really want to use your nvidia binary driver go along to the swsusp.sourceforge.net web site and look at the FAQ section for more info.
Use this Howto at your own risk, software suspend could corrupt your whole file system.
EXTRA: Allowing normal users to Hibernate without using a password
Now a normal user can hibernate the computer by issuing the command:
sudo /usr/local/sbin/hibernate
Ok Thats it for now.... As i find more modules that need restoring, or ones that I have said do that don't, I will update this FAQ. I would be greatfully for any feedback.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.