#647925 hibernate cancel option needed

#647925#5
Date:
2011-11-07 20:01:02 UTC
From:
To:
I have an HP Elitebook 2760p which can have an additional battery
connected through the dockingport, when the system wakes up from
suspend, every so often it detects the wrong battery (which reads 0%
since it's not present), decides it's about to die from lack of
electricity and hibernates itself.

Essentially the behavior is correct (if I really had a low battery I
would be very happy that the system detected it in time), but here the
behavior is very unwanted (since hibernates can take several minutes
and the wakeup the same amount of time), I would very much appreciate
it if there was something like shutdown -c but for pm-hibernate.

So far I have tried to create my own hook in /etc/pm/sleep.d/ which
kills the process that calls it when the action is 'hibernate', but
that didn't do the trick, the only script that stopped hibernate was a
script with a syntax error but that also prevented suspend which I do
want to happen.

Pointers on how to get the pid/name of the pm process and stop it
until you decide how to go forward would be very welcome.

Thanks and regards,
Eli

#647925#10
Date:
2011-11-07 23:47:59 UTC
From:
To:
I had some wrong logic in the hook I created I now got it working, I
still think it would be nice if there was a pm-hibernate -c and/or
pm-action -c or something similar.

Thanks,
Eli

For those who desire a workaround here is mine:

#!/bin/bash
#####
# Description:
# This script presents the user with a confirmation dialog when the
system tries to hibernate.
# If the user clicks 'yes' or lets the dialog timeout the hibernate
process will continue.
# If the user clicks 'no' the hibernate process will be interrupted.
#####
# Things to improve:
# - the script currently relies/depends on zenity, no fallback is provided.
# - the script currently does not dynamically detect the screen number
of the active session,
#   it assumes it to be :0.
#####
# Author/History:
# - 2011 Nov 7 - Created - E.S. Rosenberg a.k.a. Keeper of the Keys
#####

q_timeout=5
q_text="Hibernate?"

DISPLAY=:0

if (( $# >= 1 )); then
        if [[ "$1" == "hibernate" ]] || [[ "$2" == "hibernate" ]]; then
                my_pid=${BASHPID}
                pm_pid=`cat /proc/${my_pid}/stat | awk '{ print $4; }'`
                zenity --question --timeout=${q_timeout}
--text=${q_text}
                pm_act=$?
                if (( ${pm_act} == 1 )); then
                        kill -9 ${pm_pid}
                else
                        exit 0
                fi
        fi
fi

#647925#15
Date:
2011-11-12 20:05:58 UTC
From:
To:
The script in it's current form works great when the hibernate is
triggered manually (by issuing the pm-hibernate command as root), but
when the hibernate is triggered by the wrongful battery state
detection the system still attempts to hibernate without asking (and
it's not an issue with the PATH variable I already added it), it then
interrupts the hibernate halfway for reasons beyond me...
After that I need to restart some services that were already sent to sleep.

Thanks,
Eli

#647925#22
Date:
2023-12-21 17:56:09 UTC
From:
To:
Dear submitter,

as the package pm-utils has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1058701

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)