# E1705 Suspending to Ram

## Buddman

I've been trying for weeks to get a proper suspend to ram on my Dell E1705, and for the most part I now have a working solution.  The only issue I'm coming across is vbetool.  It will never properly save video state on suspend and so cannot properly restore it on resume.  I'm using hibernate-ram command to suspend with suspend2 on a 64-bit system.  I was wondering if anyone else has had sucess in getting this to work, if they use vbetool or not, etc.

Any info would be appreciated.Last edited by Buddman on Thu Feb 15, 2007 2:51 am; edited 2 times in total

----------

## Buddman

Anyone?

----------

## Buddman

Ok, I've been able to get suspend2 working with VBEtool and can suspend to ram (or swap rather), but if I leave my laptop in suspend for more than 30 minutes, upon resuming X will crash saying it cannot load on any of the screens it finds (it finds screens which it can load on, but says none are manageable).  I can suspend/resume all day if the laptop is suspended less than say 15 min, but sometime around the 15-30min mark this will happen.  Anyone run into this?

----------

## ralfonso

You might try this, it's what works for me on my 915GM.  Instead of using hibernate, I have an ACPI event on my power button (when not on AC power)

```

# suspending

cat /proc/bus/pci/00/02.0 > /tmp/videostate

hwclock --systohc

echo "mem" > /sys/power/state

# returning from suspend 

hwclock --hctosys

cat /tmp/videostate > /proc/bus/00/02.0

chvt 7

rm /tmp/videostate

```

----------

## Buddman

Tried your script - no video upon resume.  Sigh, no matter what I try I cannot get video upon resume...

Ralfonso, are you running x86 or x86-64?  Maybe this is a 64-bit issue.  I may consider going to x86 if no one else has found a solution to this issue yet.

----------

## ralfonso

x86.  I had trouble getting video to return at first.  I'm beginning to think that it wasn't my script or any settings that helped, but possibly the kernel modules.  I think I'm using the bleeding edge video modules.  YMMV.  

Also, make sure that the /proc/ path to the video state that I posted is the same on your system.  I'm not sure how that works..

----------

## Buddman

 *ralfonso wrote:*   

> I think I'm using the bleeding edge video modules.

 

Could you be more specific?  Did you use your own compiled video module or do you mean the lastest mesa driver?

EDIT:  I still don't see why hibernate will allow me to suspend/resume without issue unless more than 15 min pass (hibernate still works of course, just no screen on resume).  It almost seems like something else, maybe xorg's DPMS, is causing the issue.  However I'm not sure how to disable DPMS in xorg - trying Option "DPMS" false doesn't seem to do this when adding it in xorg.conf.  Will continue to research...

----------

## Buddman

Let me go ahead and post my configs so people know exactly what I'm using.

Here is my xorg.conf:

```
Section "ServerFlags"

        Option         "AllowMouseOpenFail" "on"

EndSection

Section "Files"

        FontPath   "/usr/share/X11/fonts/misc"

   FontPath   "/usr/share/X11/fonts/cyrillic"

   FontPath   "/usr/share/X11/fonts/100dpi/:unscaled"

   FontPath   "/usr/share/X11/fonts/75dpi/:unscaled"

   FontPath   "/usr/share/X11/fonts/Type1"

   FontPath   "/usr/share/X11/fonts/100dpi"

   FontPath   "/usr/share/X11/fonts/75dpi"

   FontPath   "/usr/share/fonts/X11/misc"

EndSection

Section "Module"

       Load  "extmod"

       Load  "i2c"

       Load  "bitmap"

       Load  "ddc"

       Load  "vbe"

       Load  "dri"

       Load  "glx"

       Load  "freetype"

       Load  "type1" 

       Load  "evdev"

EndSection

Section "InputDevice"

        Identifier      "keyboard"

        Driver          "kbd"

        Option          "Protocol"      "Standard"

        Option          "XkbRules"      "xfree86"

        Option          "XkbModel"      "pc104"

EndSection

Section "InputDevice"

        Identifier      "synaptics"

        Driver          "synaptics"

        Option          "CorePointer"

        Option          "SendCoreEvents"        "true"

        Option          "Device"                "/dev/input/mouse0"

        Option          "Protocol"              "auto-dev"

        Option      "LeftEdge"              "1700"

   Option      "RightEdge"             "5300"

   Option      "TopEdge"               "1700"

   Option      "BottomEdge"            "4200"

   Option      "FingerLow"             "25"

   Option      "FingerHigh"            "30"

   Option      "MaxTapTime"            "180"

   Option      "MaxTapMove"            "220"

   Option      "VertScrollDelta"       "100"

   Option      "HorizScrollDelta"      "100"

   Option      "MinSpeed"              "0.09"

   Option      "MaxSpeed"              "0.18"

   Option      "AccelFactor"           "0.15"

   Option      "EdgeMotionMinZ"        "17"

   Option      "EdgeMotionMaxZ"        "21"

   Option      "EdgeMotionMinSpeed"    "30"

   Option      "EdgeMotionMaxSpeed"    "35"

   Option      "LeftRightScrolling"    "1"

   Option      "UpDownScrolling"       "1"

   Option      "EmulateMidButtonTime"  "75"

   Option      "ZAxisMapping"          "4 5"

        Option          "SHMConfig"             "on"

EndSection

Section "Device"

        Identifier      "i945"

        Driver          "i810"

        Option          "NoAccel"  "false" 

        Option          "DRI"      "True"

        Option          "XVideo"   "True"

        Option          "XvMCSurfaces" "7"

        Option          "PageFlip"     "True"

        Option          "XAANoOffscreenPixmaps" "true"

   Option       "VBERestore"       "true

   

EndSection

Section "Monitor"

        Identifier      "lcd"

        HorizSync       28-96

        VertRefresh     43-60

        Gamma   0.90  0.90  0.90

EndSection

Section "Screen"

        Identifier      "screen"

        Device          "i945"

        Monitor         "lcd"

        DefaultDepth    24

EndSection

Section "ServerLayout"

        Identifier      "layout"

        Screen          "screen"        0 0

        InputDevice     "keyboard"      "CoreKeyboard"

        InputDevice     "synaptics"     "CorePointer"

        Option          "SingleCard"    "true"

        Option          "OffTime"       "5"

        Option         "AIGLX" "true"

EndSection

Section "DRI"

        Mode 0666

EndSection

Section "Extensions"

        Option         "Composite"   "Enable"

EndSection

  

```

Here is my /etc/acpi/default.sh

```
#!/bin/sh

# /etc/acpi/default.sh

# Default acpi script that takes an entry for all actions

set $*

group=${1/\/*/}

action=${1/*\//}

device=$2

id=$3

value=$4

log_unhandled() {

   logger "ACPI event unhandled: $*"

}

case "$group" in

 button)

         lid)

                 oldvt=`fgconsole`

                 grep open /proc/acpi/button/lid/LID/state > \

                      /dev/null 2>&1 && \

                      ( chvt 20; vbetool dpms on; vbetool vgastate on; chvt $oldvt )

                  ;;

#lid)

         #   xset dpms force off

         #   ;;

         *)   log_unhandled $* ;;

      esac

      ;;

   ac_adapter)

      case "$value" in

         # Add code here to handle when the system is unplugged

         # (maybe change cpu scaling to powersave mode)

         #*0)

         #   ;;

         # Add code here to handle when the system is plugged in

         # (maybe change cpu scaling to performance mode)

         #*1)

         #   ;;

         *)   log_unhandled $* ;;

      esac

      ;;

   *)   log_unhandled $* ;;

esac

```

I have the acpi lid event calling the following script so I can close my lid and reopen without losing video on opening:

```
 

#!/bin/sh

if grep -q open /proc/acpi/button/lid/*/state

  then vbetool dpms on

  else vbetool dpms off

fi

  

```

And finally, I have my power event executing hibernate.  Pushing the power button, or opening the lid (if I close it after suspending) will resume my laptop, and if under 15 min, will do so successfully.  My hibernate is using suspend2 - here is my suspend2.conf:

```
# Example suspend2.conf file.

# 

# See hibernate.conf(5) for help on the configuration items.

#

# NOTE: Suspend2 is an improved version of suspend-to-disk which currently

#       requires patching your kernel. For more information, see www.suspend2.net

# 

#       If you do not wish to patch your kernel but still be able to suspend to

#       disk, see disk.conf instead.

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

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

PowerdownMethod 3

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

## Specify a userui like this:

# ProcSetting userui_program /sbin/suspend2ui_text

# Scale CPU to full speed to make sure we suspend as fast as possible.

FullSpeedCPU yes

Include common.conf

```

and my common.conf:

```
# Configuration options common for suspending to disk or RAM.

# Options are not case sensitive.

# 

# See hibernate.conf(5) for help on the configuration items.

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

### Some global settings

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

Verbosity 0

LogFile /var/log/hibernate.log

LogVerbosity 1

# LogTimestamp yes

# AlwaysForce yes

# AlwaysKill yes

# HibernateVT 1

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

OnResume 20 /etc/acpi/lid.sh

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

# 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

# see http://bugs.debian.org/317479

# RemountXFSBoot yes

### hardware_tweaks

# IbmAcpi yes

Runi915resolution yes

FullSpeedCPU yes

### lilo

# EnsureLILOResumes yes

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

# LockConsoleAs root

# LockXScreenSaver yes

# LockGnomeScreenSaver yes

# LockKDE yes

# LockXLock yes

# LockXAutoLock yes

### misclaunch

#OnSuspend 20 echo "Good night!"

#OnResume 20 echo "Good morning!"

### modules

# UnloadModules ipw3945

# UnloadAllModules yes

UnloadBlacklistedModules yes

LoadModules auto

# LoadModulesFromFile /etc/modules

### modules-gentoo

# GentooModulesAutoload yes

### network

# DownInterfaces eth0

# UpInterfaces auto

### pause_audio

# MuteAudio yes

# PauseAudio yes

### pcmcia

# EjectCards yes

### programs

# IncompatiblePrograms xmms

### services

RestartServices laptop_mode

#StopServices alsasound

#StartServices alsasound

### vbetool

EnableVbetool yes

# RestoreVbeStateFrom /var/lib/vbetool/vbestate

# VbetoolPost yes

# RestoreVCSAData yes

### xhacks

# SwitchToTextMode yes

# UseDummyXServer yes

# DummyXServerConfig xorg-dummy.conf

### xstatus

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

# XStatus gnome

# XmessageDisable yes

# 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

```

This works except for the fact that, again, if I suspend for more than 15 min, I don't have video after resuming.  I can suspend/resume multiple times under 15 min and it never crashes - always works.  Funny thing is if the no video problem arises, I can kill X, but X won't restart and give me the "screens found, but none manageable" error.

So, any ideas?

BTW, using latest version of Vbetool (earlier versions give the same result), using Xorg 7.1 with AIGLX and Beryl, mesa 6.5.1-r1, and have tried this with multiple kernels that have suspend2 support.

EDIT:  What is causing the screen to go black/blank in gentoo after 10 min of inactivity?  I ran xset -dpms and the screen still went black.  I'm sure this has to be causing the issue with suspend (I ran suspend for exactly 10 minutes and have the resume video blank issue, anything before 10 min is fine) - if I can just have the screen stay on all the time without it going to black then I think my issue will be resolved.  At the very least I need to test this theory out.  I'm using XFCE 4.4, so it's not the desktop causing it (no built in power manager - maybe I need something like this?).  Any help would be appreciated.

EDIT#2:  Figured out what is causing the blank screen after 10 min of inactivity.  It's a xorg setting, but I'm not sure how to disable it.  Running xset q tells me DPMS is disabled, but it also tells me this:

Screen Saver:

  prefer blanking:  yes    allow exposures:  yes

  timeout:  600    cycle:  600

Anyone know how to disable this?

----------

## Buddman

Let me also go ahead and post the error.  This is the last part of my Xorg.log file:

```
(II) Setting vga for screen 0.

(II) Loading sub module "int10"

(II) LoadModule: "int10"

(II) Loading /usr/lib64/xorg/modules/libint10.so

(II) Module int10: vendor="X.Org Foundation"

   compiled for 7.1.1, module version = 1.0.0

   ABI class: X.Org Video Driver, version 1.0

(II) Loading sub module "vbe"

(II) LoadModule: "vbe"

(II) Reloading /usr/lib64/xorg/modules/libvbe.so

(II) Loading sub module "vgahw"

(II) LoadModule: "vgahw"

(II) Loading /usr/lib64/xorg/modules/libvgahw.so

(II) Module vgahw: vendor="X.Org Foundation"

   compiled for 7.1.1, module version = 0.1.0

   ABI class: X.Org Video Driver, version 1.0

(II) I810(0): Creating default Display subsection in Screen section

   "screen" for depth/fbbpp 24/32

(**) I810(0): Depth 24, (--) framebuffer bpp 32

(==) I810(0): RGB weight 888

(==) I810(0): Default visual is TrueColor

(**) I810(0): Option "NoAccel" "false"

(**) I810(0): Option "DRI" "True"

(**) I810(0): Option "PageFlip" "True"

(**) I810(0): Option "XVideo" "True"

(**) I810(0): Option "VBERestore" "true"

(II) Loading sub module "int10"

(II) LoadModule: "int10"

(II) Reloading /usr/lib64/xorg/modules/libint10.so

(II) I810(0): initializing int10

(EE) I810(0): V_BIOS address 0x0 out of range

(EE) I810(0): VBE initialization failed.

(II) UnloadModule: "i810"

(II) UnloadModule: "int10"

(II) UnloadModule: "vgahw"

(II) Unloading /usr/lib64/xorg/modules/libvgahw.so

(II) UnloadModule: "vbe"

(II) UnloadModule: "int10"

(II) Unloading /usr/lib64/xorg/modules/libint10.so

(EE) Screen(s) found, but none have a usable configuration.

Fatal server error:

no screens found

```

This ONLY happens after 10+ min of suspend.  I can restart X all day and it restart fine as long as I don't suspend for 10 min or more.

----------

## Buddman

Doesn't appear to be an issue with 915resolution hack - problem occurs whether it is running or not.

----------

## Buddman

Tested this more extensively.  At 9 min suspending, I can resume fine (tried it 5 times in a row while timing it), but at 10 min, I get the X issue.  Does anyone know why this would be happening???

----------

## Buddman

Bump...anyone?

----------

## Buddman

Using a bleeding edge i915 driver now - no change.  Tried a few different options in xorg.conf, disabled DPMS (left it enabled as well), disabled all the blank time settings on the screen, left them the same - it's always the same issue.  This is the oddest problem I've ever run across.  Again, if I suspend for more than 10 min, I get a blank screen on resume and cannot restart X.  However, I CAN go to chvt1 and then back to chvt7 and get my screen back like that, but as soon as X is restarted, it gives me the above error I posted.  If I suspend under 9 min this does not happen and I can restart X all I want.  There HAS to be a solution to this.  Can anyone help?

----------

## Buddman

Anyone???

----------

## Kate Monster

The X errors you're getting seem to indicate with a problem re-initializing the video card. But you say that console still displays stuff, and your X session still displays stuff, so maybe this is a problem with the X drivers and your card?

If you're willing to live with the screwy X after resume, you can automate the VT switching by setting 

```
OnSuspend "chvt 1"

OnResume "chvt 7"
```

It is a bit messy though. Also, have you tried fiddling with "UseTextModeEnable" and/or "UseDummyXServer" in common.conf?

----------

## Buddman

I've tried SwitchtoTextmode setting, but not the dummy x.  I still don't see why after exactly 10 min this will happen.  Also, if I try to suspend/resume again after X crashes, on resume my PC will reboot, and when the kernel attempts to load it will load the suspend image and I'm back at my desktop again.  Weird....

Still looking for an answer to this, but thanks for any help.

----------

## Buddman

Ok, enabling UseDummyXServer resolves the issue!  I can restart X, etc.  Will do more testing to confirm.  If this works then looks like 64-bit users with 950GMA will finally have a good working solution for suspending.

Edit:  NM, spoke too soon.  X still gives the error if I try to restart it, but at least the screen is coming back without having to chvt1 and then back to 7.  Really not a solution as still suffering from the same problem, but it's a step forward.

----------

## Buddman

I've had hibernate report everything in verbose mode and found that upon resuming, I get the following error:

"Real mode call failed"

Anyone have a clue as to what this means?  I think it's related to the X problem.

----------

## Buddman

Anyone know what that error means?  I've searched everywhere but haven't found a reference to it concerning suspend2 yet....

----------

## Buddman

Found the issue about the 10 min deal.  Seems it has something to do with DPMS not suspending.  I found that when attempting to resume after 10 minutes, VBETool (or rather hibernate-ram) gives the following error when trying to post video state:

/usr/share/hibernate/scriptlets.d/vbetool: line 59:  12746 Segmentation fault

I tried using a script that activated upon suspend which basically was "vbetool dpms suspend," but no go there, same error occurs.  Anyone know how to fix this?

----------

