Bug 7530 - Problems w/ suspend and resume on Prostar 1200 Laptop
Problems w/ suspend and resume on Prostar 1200 Laptop
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: apmd (Show other bugs)
6.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-12-03 01:22 EST by Donald Greer
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-12-08 10:00:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Donald Greer 1999-12-03 01:22:42 EST
I used the apmd on my Prostar 1200 (Tiwanese OEM for certain Dell and
Gateway models) without difficulty.

Since upgrading to 6.1, I've noticed two problems:

1. On user-suspend, the first time I press the suspend key sequence, I get
a message "User suspend requested" or some such on the console but nothing
happens.  The second time I hit the key sequence the system suspends
normally.

2. When I suspend my system (I use hibernation mode ... yeah, yeah, I know
it isn't officially supported, but it works about 97% of the time) when the
system resumes, it no longer updates the system clock to sync with the HW
clock.  I get a message saying how long the system was suspended (as an
adjustment of minutes) but this the system doesn't correct the clock.

For 1, I simply must hit the suspend twice.  For 2, I need to figure out
how to get the "proxy" stuff in the man page working, and put in a "hwclock
--hctosys" command and that should fix it.

If you're curios, the limitations I've found to hibernation are:
- Don't leave your terminal in X windows (do an Alt-F1 before suspending).
- Don't leave any network apps running (servers in listen mode seem fine,
but Netscape or Applix will hose you about %40 of the time).
Comment 1 Donald Greer 1999-12-06 22:24:59 EST
I've written an "apmd_proxy" script that resolves the problem with the date and
with the hibernation thing.  I stress tested it by loading bunches of X and
networking apps and suspending from the X console (usually doing hangs the
machine about 50% of the time on restart).
Here's the script:

#!/bin/bash
#
# apmd_proxy      This shell script takes care of starting and stopping
#                 various programs and services prior to suspending and
#                 resuming.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

SUSPEND_DATA=/var/run/apmd.suspend.data

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        ps ax|egrep -v 'ps ax|egrep|perl' |perl -n -e '$_ =~ /^\s*(\d+).*/;print
"$1\n";'> $SUSPEND_DATA
        ;;
   stop)
        # Stop daemons.
        [ -e $SUSPEND_DATA ] && rm $SUSPEND_DATA
        ;;
suspend)
        # Suspend requested.
        #[ -e /tmp/suspend.log ] || touch /tmp/suspend.log
        #echo "Stating Suspend (`date`)" >>/tmp/suspend.log
        #ps ax > /tmp/presuspend
        for i in `ps ax|egrep -v 'ps ax|egrep|bash|perl|kill|cardmgr|apmd' |perl
-n -e '$_ =~ /^\s*(\d+).*/;print "$1\n";'`; do
         # echo -n `ps ax|grep $i`>> /tmp/suspend.log
         # grep $i $SUSPEND_DATA >/dev/null || echo 'STOPPED' >>
/tmp/suspend.log
         # grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
/tmp/suspend.log
          sync
          grep $i $SUSPEND_DATA >/dev/null || kill -STOP $i
        done
        #echo "System quiet... suspending (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postsuspend
        sync
        ;;
 resume)
        # Resume requested.
        #[ -e /tmp/suspend.log ] || touch /tmp/suspend.log
        #echo "Stating Resume (`date`)" >>/tmp/suspend.log
        /sbin/hwclock --hctosys
        #echo "Time Corrected (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/preresume
        for i in `ps ax|egrep -v 'ps ax|egrep|bash|perl|kill|cardmgr|apmd' |perl
-n -e '$_ =~ /^\s*(\d+).*/;print "$1\n";'`; do
        #  echo -n `ps ax|grep $i`>> /tmp/suspend.log
        #  grep $i $SUSPEND_DATA >/dev/null || echo 'RESTARTING' >>
/tmp/suspend.log
        #  grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
/tmp/suspend.log
          sync
          grep $i $SUSPEND_DATA >/dev/null || kill -CONT $i
        done
        #echo "All processes restored (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postresume
        ;;
standby)
        ;;
      *)
        echo "Usage: apmd {start|stop|suspend|resume|standby}"
        exit 1
esac

--------------------------
  You can remove the echos... they are simply the debugging info (and slow
things down a bunch).
  The idea is that when apmd is called, all the things that come before it are
"safe" and should not be touched (things like init).  You can also add things to
the egrep that should be ignored (like the bash shell that is running the script
:^).
  I'm sure it could be cleaned up a lot, but it's a quick hack that works and I
thought it would give y'all a starting place at a fix for hibernating machines
like mine.
  BTW, it also fixes the time problem with a call to hwclock.
  I'm not sending this to the apmd developers.  I figured y'all would clean it
up a bit and you would be donating the cleaned copy.
  Don
Comment 2 Bernhard Rosenkraenzer 1999-12-08 10:00:59 EST
Have a look at the apmd package in rawhide - it solves the hibernation problem
and can work around some hardware problems (such as broken harddisks that need
hdparm settings after a suspend-to-disk).

Note You need to log in before you can comment on or make changes to this bug.