# Strange Suspend2 behaviour [unsolved],and Speedstep [solved]

## ilm

I've just installed Gentoo on my Acer TM 803LCi with the Suspend2-patched kernel.  I'm now trying to get hibernation to work.  However, if I issue the hibernate command, as far as I can tell everything stops, but the laptops still on but with a blank screen.  If I use hibernate-ram, it suspends, but as soon as I wake it, it shuts down.

Heres my hibernate.conf:

```
# Example hibernate.conf file. Adapt to your own tastes.

# Options are not case sensitive.

# 

# Run "hibernate -h" for help on the configuration items.

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

### Choose your Suspend method. You currently have 3 choices:

###

###    suspend2            Software Suspend 2 (requires kernel patches from

###                        http://www.suspend2.net/)

###

###    sysfs_power_state   Uses /sys/power/state to suspend (activates pmdisk

###                        on kernels < 2.6.8, or vanilla swsusp otherwise).

###

###    acpi_sleep          Uses /proc/acpi/sleep to activate swsusp, or other

###                        ACPI sleep state supported by your machine.

###

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

### 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/hda6

## 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

ProcSetting extra_pages_allowance 5000

### 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

# FBSplashTheme suspend2

### filesystems

# Unmount /nfsshare /windows /mnt/sambaserver

 UnmountFSTypes smbfs nfs vfat ntfs

# UnmountGraceTime 1

# Mount /windows

### 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 eth1

 UpInterfaces auto

### pcmcia

 EjectCards yes

### programs

 IncompatiblePrograms xmms

### services

 RestartServices alsasound hotplug

# 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 x

 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

```

In an unrelated issue, is there any way I can get my laptop to automatically scale CPU/RAM performance when on batteries like in XP?  I can use cpufreq to manually set various power modes, but I'd like it to run at full capacity on mains power and use the cpu stepping on batteries.

The (anticipated) help is very much appreciated!!!!!Last edited by ilm on Sun Aug 13, 2006 12:29 pm; edited 1 time in total

----------

## beatryder

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

# PowerdownMethod 5
```

Change that to

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

PowerdownMethod 5
```

----------

## a7thson

 *Quote:*   

> 
> 
> In an unrelated issue, is there any way I can get my laptop to automatically scale CPU/RAM performance when on batteries like in XP? I can use cpufreq to manually set various power modes, but I'd like it to run at full capacity on mains power and use the cpu stepping on batteries.
> 
> The (anticipated) help is very much appreciated!!!!!
> ...

 

Sure there is, but it involves some work.  The Gentoo Power Management guide is quite good and fairly comprehensive in addressing exactly this.  (http://www.gentoo.org/doc/en/power-management-guide.xml).  Go from there and ask specific questions when you hit roadblocks.

the idea is:

1) compile kernel with support for userspace cpu frequency governor

2) create a new runlevel for "battery" mode by copying the existing "default" runlevel

2) install acpid to catch acpi messages and scripts are patched to dynamically change runlevel on acpi/power events

3) configure cpufreqd to run in the "default" and "battery" runlevels with different governors.

Creating a new runlevel (call it "battery" as does the guide, or whatever), and hooking acpi events via supplying the appropriate scripts to the acpi daemon will allow the system to react to the occurence of low-level ACPI events, like switching power sources from A/C to battery and vice versa.

I would just be restating the subsection of that guide: Creating A "battery" Runlevel.  Follow that step-by-step.  Do note though that runlevels can be tricky to work with and can cause unexpected surprises - it's sort of a hackish approach but it does work, so pay special attention to this part in the docs:

 *Quote:*   

> 
> 
> Due to the nature of the event mechanism, your laptop will boot into runlevel default regardless of the AC/battery state. This is fine when running from AC, but we'd like to boot into the battery runlevel otherwise. One solution would be to add another entry to the boot loader with the parameter softlevel=battery, but it's likely to forget choosing it. A better way is faking an ACPI event in the end of the boot process and letting pmg_switch_runlevel.sh script decide whether a runlevel change is necessary. Open /etc/conf.d/local.start in your favourite editor and add these lines:
> 
> Code Listing 2.11: Runlevel adjustment at boot time by editing local.start
> ...

 

CPU power management subsection of the guide is right below that, and involves modifying /etc/cpufreqd.conf to create the appropriate profile for a "battery" runlevel that scales down the processor speed (which reduces both power consumption and CPU core temperature of course).  There are other options mentioned in the guide as well.  Personally I run "ondemand" even during normal use and A/C power, since I rarely eat up 90-100% CPU for extended periods of time and the governor adjusts fairly responsively, "performance" means the cpu is spending 70% of its time idling at full throttle.  But your requirements might be otherwise.

Good luck, it's a big topic.

----------

## beatryder

 *a7thson wrote:*   

>  *Quote:*   
> 
> In an unrelated issue, is there any way I can get my laptop to automatically scale CPU/RAM performance when on batteries like in XP? I can use cpufreq to manually set various power modes, but I'd like it to run at full capacity on mains power and use the cpu stepping on batteries.
> 
> The (anticipated) help is very much appreciated!!!!!
> ...

 

I dont like doing it the way that the gentoo guide says to. I think having an extra run-level adds more work in maintaining your system. With the GPMG you need to add/delete things to two runlevels when you update. This is stupid. I have a very nice way of dealing with it.

I have some scripts, which I wont post here because its too long and I am pressed for time. But if you search the forums for my posts you should find them. I am going to be making a guide on my website soon, so if you are interested PM me and I will notify you when I post it  :Very Happy: 

----------

## a7thson

 *Quote:*   

> 
> 
> I dont like doing it the way that the gentoo guide says to. I think having an extra run-level adds more work in maintaining your system. With the GPMG you need to add/delete things to two runlevels when you update. This is stupid. I have a very nice way of dealing with it.
> 
> 

 

Truthfully I never liked it either, it seems like a quick-and-dirty hack in that you basically 'fake' an ACPI event, plus have a bunch of crap to deal with when the runlevel switches, though it works fine when booting - maybe it could indeed be better handled with a script than through the init system.

 *Quote:*   

> 
> 
> I have some scripts, which I wont post here because its too long and I am pressed for time. But if you search the forums for my posts you should find them. I am going to be making a guide on my website soon, so if you are interested PM me and I will notify you when I post it 
> 
> 

 

Cool.  I'm curious to see what you've cooked up.  I gave up on trying to find a better solution, due to laziness... mainly because I didn't need to keep my laptop (or "desktop replacement" as Dell now calls it) mobile anymore, and now it's tethered to external harddrives, wireless keyboard, a serial adapter etc.  :Smile:  so it rarely moves.

----------

## ilm

Thanks everyone!!!

beatryder: are the scripts you're talking about these ones: http://gentoo-wiki.com/HARDWARE_Dell_Latitude_D610#ACPI

If so, is the lid script laptop-specific? Also, how do you use these scripts?  Are they automatically run by acpid?

As for the hibernation script, I'm just about to try that out once the current emerge update finishes!!!

Edit 1: OK, hibernate-ram works.  Is there any way I can password protect it when it comes out of standby?

----------

## beatryder

 *ilm wrote:*   

> Thanks everyone!!!
> 
> beatryder: are the scripts you're talking about these ones: http://gentoo-wiki.com/HARDWARE_Dell_Latitude_D610#ACPI
> 
> If so, is the lid script laptop-specific? Also, how do you use these scripts?  Are they automatically run by acpid?
> ...

 

Yup, those would be them! I am soon going to have a SVN repos that people can get them from. I just have to set it up.

----------

## ilm

Maybe I'm confused with what hibernation actually does.  I thought it saved everything in RAM etc to disk, then shut down.  On restart, it'd then go and restore the RAM, etc.  Thus, it'd be the same as halting the system, but would have a faster boot time and woul have  all the programs already open.

However, when I used the hibernate command, the screen blanked, my wireless LED started blinking, then as soon as I touched a key it asked for my password and started back up.

Also, how do I get those ACPI scripts to work?  Do I have to have the power unplugged on boot, or will it automatically detect when its unplugged???

----------

## beatryder

Dont use the hibernate-ram script just hibernate

----------

## ilm

But is the hibernate script meant to shut the computer down (ala Windows hibernation), or just suspend it (ala Windows sleep/suspend)???

Also, the ACPI scripts don't seem to be working...

----------

## beatryder

"hibernate" will make it power down when it is finished copying to disk, "hibernate-ram" is supposed to put it to sleep. depending on you have configured it.

As for why your ACPI scripts aren't working. I cant help you with without knowing more.

1) Do you have acpid installed and running?

2) Which kernel version are you running?

3) does your notebook require special modules to work?

4) post exactly what you have in your /etc/acpi/default.sh

----------

## ilm

Well, hibernate never seems to power down...

As for the ACPI scripts, I just found out that I need to flash my bios and install the new DSDT table (what is a DSDT table, anyway???), so that's probably what's wrong with that.

----------

## ilm

OK, I've been busy the last few weeks, so I've only managed to try and get ACPI working today.

First of all, is there an easy way to tell if ACPI is working?

beatryder (hope you're still going to be helping me out here!!!!!!!!): 

1) As far as I know, ACPID is up and running (using rc-update add acpid boot)

2) I'm using the suspend2-sources kernel version 2.6.16-r8

3) According to the wiki (http://gentoo-wiki.com/HARDWARE_Acer_Travelmate_803LCi_Manual), all I've got to do is flash my bios and update the DSDT, which I've done.  Then again, parts of it don't seem to have been updated for a while...

4) Here's my /etc/acpi/default.sh:

```

#!/bin/sh

# Copyright 1999-2004 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/sys-power/acpid/files/acpid-1.0.4-default.sh,v 1.1 2005/03/15 19:15:53 ciaranm Exp $

# Default acpi script that takes an entry for all actions

set $*

group=${1/\/*/}

action=${1/*\//}

case "$group" in

   button)

      case "$action" in

         power)   /sbin/init 0

            ;;

         lid)

            /etc/acpi/lid.sh

            ;;

         *)   #logger "ACPI action $action is not defined"

            ;;

      esac

      ;;

   ac_adapter)

      /etc/acpi/ac-adapter.sh

      ;;

   *)

      #logger "ACPI group $group / action $action is not defined"

      ;;

esac

```

The scripts here are the ones listed on the wiki page for the Dell D610, and I've made them executable.  Is there anything else I have to do to make them work???

----------

## ilm

I managed to get those scripts working:  the two main problems were 1. I needed to use the battery event rather than the ac_adaptor event in default.sh and 2. for some reason, minmhz and maxmhz in ac-adaptor.sh were the wrong way round.

So that works now.  But I can't seem to get the governors working properly.  I want it going full-bore when plugged in, but to stay low as possible when on battery, but go up when required.  From what I found, ondemand is meant to fulfill this behaviour, but it doesn't - it stays at the low end of the fequency spectrum.  Does anyone know why?

Also, would I be better off getting something like cpufreqd so that the processor level works off battery, load, etc?

With regards to Suspend2, whenever I try to hibernate, it fails with the following error message in the log (I'm posting the entire contents of 'dmesg | grep "Suspend"'):

```
Suspend2 Core.

Suspend2 Compression Driver loading.

Suspend2 Encryption Driver loading.

Suspend2 Swap Writer loading.

Suspend2 FileWriter loading.

Suspend2 2.2.5: Swapwriter: Signature found.

Suspend2 2.2.5: Resuming enabled.

Suspend2 2.2.5: Swapwriter: No swap signature found at specified location.

Suspend2 2.2.5: Swapwriter: No swap signature found at specified location.

Suspend2 2.2.5: Software suspend is disabled.
```

Why can't it find the swap signature???  Is the fact that I compiled my kernel with both filewriter and swapwriter support???

----------

## ilm

OK, I worked this out (but forgot to post it back here): I had my swap partition listed wrong in the configuration (i.e. it was looking at the wrong partition)

----------

