# Suspend2 unable to unload some modules

## G2k

I am trying to get Suspend2 to work but there are some problems with module unloading

```
# hibernate

Some modules failed to unload: sony_acpi ipw2200 ieee80211 ieee80211_crypt nvidia firmware_class

Some modules failed to unload: nvidia

hibernate: Aborting suspend due to errors in ModulesUnloadBlacklist (use --force to override).
```

I am using a Sony Vaio VGN-FS660...I guess I could build the ieee80211 and sony_acpi things in-kernel right? But as for the nvidia-kernel and the other modules, how can I make Suspend2 successfully do its job? I'm using media-video/nvidia-kernel-1.0.8756. This is my /etc/hibernate/hibernate.conf

```
### suspend2 (for Software Suspend 2)

UseSuspend2 yes

Reboot no

EnableEscape yes

DefaultConsoleLevel 1

Compressor lzf

Encryptor none

# ImageSizeLimit 200

## useful for initrd usage:

# SuspendDevice swap:/dev/hda2

## Powerdown method - 3 for suspend-to-RAM, 4 for ACPI S4 sleep, 5 for poweroff

# PowerdownMethod 5

## Any other /proc/software_suspend setting can be set like so:

# ProcSetting expected_compression 50

## Or traditionally like this:

# Suspend2AllSettings 0 0 2056 65535 5

## Or even from the results of hibernate --save-settings with this:

# Suspend2AllSettingsFile /etc/hibernate/suspend-settings.conf

## For filewriter:

# FilewriterLocation /suspend_file 1000

# VerifyFilewriterResume2 yes

# ProcSetting userui_program /sbin/suspend2ui_text

### sysfs_power_state

## To use /sys/power/state to suspend your machine (which may offer

## suspend-to-RAM, suspend-to-disk, standby, etc) comment out all the options

## above for Software Suspend 2, below for acpi_sleep, and uncomment this line.

## You may replace mem with any one of the states from "cat /sys/power/state"

# UseSysfsPowerState mem

# PowerdownMethod shutdown

### acpi_sleep

## To use ACPI to suspend your machine (via /proc/acpi/sleep), comment out

## all the options above for Software Suspend 2 and sysfs, and uncomment this

## line. The number refers to the ACPI sleep state - 3 is suspend-to-RAM and

## 4 is suspend-to-disk.

# UseACPISleep 4

##############################################################################

### Some global settings

##############################################################################

Verbosity 0

LogFile /var/log/hibernate.log

LogVerbosity 1

# AlwaysForce yes

# AlwaysKill yes

# HibernateVT 15

Distribution gentoo

# XDisplay :0

##############################################################################

### Scriptlets

###   Scriptlets provide support for doing all sorts of things before and after

###   suspending. The defaults settings here should work for most people, but

###   you may wish to edit these to taste. Consult "hibernate -h" for help on

###   the configuration settings.

##############################################################################

### bootsplash

## If you use bootsplash, also enabling SwitchToTextMode is recommended if

## you use X, otherwise you may end up with a garbled X display.Bootsplash on

# BootsplashConfig /etc/bootsplash/default/config/bootsplash-1024x768.cfg

### clock

SaveClock restore-only

### devices

# IncompatibleDevices /dev/dsp /dev/video*

### diskcache

# DisableWriteCacheOn /dev/hda

### fbsplash (enable SwitchToTextMode if you use this)

FBSplash on

SwitchToTextMode on

# FBSplashTheme suspend2

### filesystems

# Unmount /nfsshare /windows /mnt/sambaserver

# UnmountFSTypes smbfs nfs

# UnmountGraceTime 1

# Mount /windows

UnmountFSTypes ntfs

Unmount /mnt/win

OnResume 20 mount /mnt/win

### grub

# ChangeGrubMenu yes

# GrubMenuFile /boot/grub/menu.lst

# AlternateGrubMenuFile /boot/grub/menu-suspended.lst

# BackupGrubMenuFile /boot/grub/menu.lst.hibernate.bak

### hardware_tweaks

# IbmAcpi yes

# RadeonTool yes

### lilo

# EnsureLILOResumes yes

### lock (generally you only want one of the following options)

# LockConsoleAs root

# LockXScreenSaver yes

# LockKDE yes

# LockXLock yes

# LockXAutoLock yes

### misclaunch

# OnSuspend 20 echo "Good night!"

# OnResume 20 echo "Good morning!"

### modules

# UnloadModules snd_via82cxxx usb-ohci

UnloadAllModules yes

UnloadBlacklistedModules yes

LoadModules auto

# LoadModulesFromFile /etc/modules

### modules-gentoo

GentooModulesAutoload yes

### network

# DownInterfaces eth0

# UpInterfaces auto

### pcmcia

# EjectCards yes

### programs

# IncompatiblePrograms xmms

### services

# RestartServices postfix

# StopServices alsasound

# StartServices aumix

### vbetool

# EnableVbetool yes

# RestoreVbeStateFrom /var/lib/vbetool/vbestate

# VbetoolPost yes

# RestoreVCSAData yes

### xhacks

SwitchToTextMode yes

# UseDummyXServer yes

### xstatus

## This can be set to gnome, kde or x:

# XStatus gnome

XSuspendText Preparing to suspend...

XResumeText Resuming from suspend...

## When using XStatus x, and you have xosd installed:

# XosdSettings --font -misc-fixed-medium-r-semicondensed--*-120-*-*-c-*-*-* --colour=Green --shadow 1 --pos bottom --align center --offset 50
```

----------

## pem

In your /etc/X11/xorg.conf, what is your AGP setting?

----------

## G2k

hmmm. I don't have it in my xorg.conf, but dmesg | grep agp returns

```
Linux agpgart interface v0.101 (c) Dave Jones

agpgart: Detected an Intel 915GM Chipset.

agpgart: AGP aperture is 256M @ 0x0
```

what do I have to put in my xorg.conf?

----------

## pem

It means that you are using the autodetection which turns to use the kernel's AgpGart driver. This driver does not allow the nvidia driver to unload properly (check nvidia readme). The best way to proceed is to keep AGP on (though it can be disabled completely) by specifying the nvidia's implementation:

```
Section "Device"

    Driver          "nvidia"

    ...

    Option          "NvAGP"                 "1"             # NvAgp

    ...

EndSection
```

----------

## chrismortimore

Try "hibernate --force".  I found that my laptop suspends and resumes reliably even though some of the modules I use are blacklisted.  If it works, just remove them from the blacklist.

----------

## G2k

Ok so apparently I was able to suspend successfully (i've only tried without using X, I'll try with X later) but I must say that I'm a bit taken back by the fact that it's as if I had shutdown normally...I mean, my computer booted up, I saw the grub screen, then I chose Linux and after doing checks to the Filesystem and whatnot, the hibernate image decompressed and took me back to where I was...how is that hibernating my computer? That's just improving boot time by about 5 seconds. Am I doing something wrong or is it just like that? I'm a bit let down, I thought that when I powered on my console would reappear straight away.  :Crying or Very sad:  ..isn't that how it works with Windows and MacOS?

----------

## pem

Well, I was kinda disapointed too concerning the speed. suspend has to take all your memory and compress it (it's even worth without compression owing to my slow laptop disk ) and finally writes it. When you restart, your complete kernel has to get initialized, then comes the uncompression and the write back in memory. Plus, there are couples of things that are not restored properly and some services must be restarted (for me I restart my wifi and hotplug services). Arggh!

Still, it remains interesting to find back your apps the same way they were started...

You can shorten this time by adjusting stuff in your /etc/hibernate/hibernate.conf. Here's mine as example:

```
UseSuspend2 yes

EnableEscape no

DefaultConsoleLevel 0

Compressor lzf

Encryptor none

PowerdownMethod 4

Verbosity 0

LogFile /var/log/hibernate.log

LogVerbosity 0

Distribution gentoo

SaveClock restore-only

UnloadBlacklistedModules yes

LoadModules auto

DownInterfaces wlan0

UpInterfaces wlan0

RestartServices hotplug

SwitchToTextMode no

UseDummyXServer no

XStatus gnome

XSuspendText Sleep!

XResumeText Wake up!
```

And I use fbsplash and gnome  :Exclamation: 

----------

## chrismortimore

 *G2k wrote:*   

> Ok so apparently I was able to suspend successfully (i've only tried without using X, I'll try with X later) but I must say that I'm a bit taken back by the fact that it's as if I had shutdown normally...I mean, my computer booted up, I saw the grub screen, then I chose Linux and after doing checks to the Filesystem and whatnot, the hibernate image decompressed and took me back to where I was...how is that hibernating my computer? That's just improving boot time by about 5 seconds. Am I doing something wrong or is it just like that? I'm a bit let down, I thought that when I powered on my console would reappear straight away.  ..isn't that how it works with Windows and MacOS?

 There are 3 levels of suspend:

"Standby": It just switches a few things off and gives rather piddly power savings.  I don't think anyone really uses this.

"Suspend to RAM": Computer everything it needs into the RAM and powers down everything except the RAM and a few essentials needed to power back.  This is what Windows and MacOSX call "Sleep"

"Suspend to disk": This is what you've set up.  It does a suspend to RAM, writes everything to disk, then shuts down.  On the next boot, it reloads the image and restores your computer to how it was.  Windows calls this "Hibernation".

Standby and Suspend to RAM take a few seconds to suspend and to restore, because they don't actually power down the computer.  If you want fast suspending, use these.  However, with these modes, your battery life will still decrease and will eventually run out.  And if you use these modes and put it in your bag, your laptop might overheat (a guy I worked with fried his laptop doing this).

Suspend to disk is useful if you (for example) are on the train writing a report and get to your stop and have to move.  You can hibernate your machine, and when you get to your next sitting position, you can switch your machine back on and continue as you were, with the benefit of your battery life is not reduced.  I always use suspend to disk, because I always have certain programs running and it is nice to just switch my laptop on and have it all set up as I want, without having to load everything again.

----------

## G2k

yeah I guess I'm looking for Suspend to RAM then...also cus my laptop has 1 gig of RAM and I never really use it (or abuse it should I say)  :Twisted Evil: 

----------

## frederik

Concerning the modules not unloading - I never got my ipw3945 module to unload with rmmod. But it works using 

```
modprobe -r ipw3945
```

. So if this is the same for your ipw you could try:

```

OnSuspend 20 modprobe -r ipwXXXX

```

in your hibernate.conf

----------

## Lloeki

suspend2 saves the whole ram (incl. disk cache) by default, which results in a 100% state-restored 100% responsive system.

if you want do discard some cache, try ImageSizeLimit setting, and set it to nocache. this way I hibernate in 3sec, resume in 2.

----------

## frederik

This is really a great tip - maybe you want to put it into the wiki or so? Makes everyday resume and suspend much more fun  :Smile: 

----------

