Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like hybrid suspend to act a certain way.

If I add the code

# Always use suspend_hybrid instead of suspend
if [ "$METHOD" = "suspend" ]; then
METHOD=suspend_hybrid
fi
PM_HIBERNATE_DELAY=XX

to

/etc/pm/config.d/00-use-suspend-hybrid

where XX is the number of seconds until the computer hibernates, does XX indicate the number of seconds until the computer writes the state of the RAM to the disk, or until the computer actually goes into hibernation mode, or both?

I would like to use a hybrid suspend in which when I close the lid of my laptop, the state of the RAM is both written to the disk and kept in the RAM at the time that I close the lid of the laptop, and then after the XX seconds the computer actually goes into hibernate (drops the contents of the RAM from the RAM). If this is not what the above code does, can someone give me the code that will do this? Thanks!

Code taken from this question: How do I use pm-suspend-hybrid by default instead of pm-suspend?

UPDATE: I tested this for myself by simply taking out the battery of my laptop about thirty seconds after using hybrid suspend by closing the lid. When I started back up, the system booted as it would normally. This also occurred when I omitted the

PM_HIBERNATE_DELAY=XX

line and when I ran

sudo pm-suspend-hybrid

from the terminal. Therefore, It can be concluded that the system does NOT write the state of the RAM to the disk as soon as it suspends.

Am I correct in this assumption?

If I am, I would like to know how to make hybrid suspend write the state of the RAM to the disk when the computer suspends, not after the timer expires.

I know that this question is out of vanity more than anything, but it has been posted for a month with not even a comment. Is there someplace anybody knows of that I can go where I might be able to come up with a solution for myself?

share|improve this question

1 Answer

I've found than on my device (ASUS 1215b), the resume failed cause the suspen NetworkManager Failed...

After some debbuging, I've found that the dbus_set command on file /usr/lib/pm-utils/sleep.d/55NetworkManager failed. Then, Ive replaced the content of the two functions on that file (suspend_nm() and resume_nm()), with:

#!/bin/sh
# If we are running NetworkManager, tell it we are going to sleep.
# TODO: Make NetworkManager smarter about how to handle sleep/resume
#       If we are asleep for less time than it takes for TCP to reset a
#       connection, and we are assigned the same IP on resume, we should
#       not break established connections.  Apple can do this, and it is
#       rather nifty.

. "${PM_FUNCTIONS}"

suspend_nm()
{
    # Tell NetworkManager to shut down networking
        printf "Having NetworkManager put all interaces to sleep... The AixMaN Way..."
    service network-manager stop && echo Done. || echo Failed.
}

resume_nm()
{
    # Wake up NetworkManager and make it do a new connection
    printf "Having NetworkManager wake interfaces back up... The AixMaN Way..."
    service network-manager start && echo Done. || echo Failed.
}

case "$1" in
    hibernate|suspend)
        suspend_nm
        ;;
    thaw|resume)
        resume_nm
        ;;
    *) exit $NA
        ;;
esac
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.