Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 7530

Summary: Problems w/ suspend and resume on Prostar 1200 Laptop
Product: [Retired] Red Hat Linux Reporter: Donald Greer <dgreer>
Component: apmdAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 1999-12-08 15:00:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Donald Greer 1999-12-03 06:22:42 UTC
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

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-07 03:24:59 UTC
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:

# 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


# See how we were called.
case "$1" in
        # Start daemons.
        ps ax|egrep -v 'ps ax|egrep|perl' |perl -n -e '$_ =~ /^\s*(\d+).*/;print
"$1\n";'> $SUSPEND_DATA
        # Stop daemons.
        [ -e $SUSPEND_DATA ] && rm $SUSPEND_DATA
        # 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' >>
         # grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
          grep $i $SUSPEND_DATA >/dev/null || kill -STOP $i
        #echo "System quiet... suspending (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postsuspend
        # 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' >>
        #  grep $i $SUSPEND_DATA >/dev/null && echo 'RUNNING' >>
          grep $i $SUSPEND_DATA >/dev/null || kill -CONT $i
        #echo "All processes restored (`date`)" >> /tmp/suspend.log
        #ps ax > /tmp/postresume
        echo "Usage: apmd {start|stop|suspend|resume|standby}"
        exit 1

  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.

Comment 2 Bernhard Rosenkraenzer 1999-12-08 15:00:59 UTC
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).