Slow to begin sleep.

dorayme wrote on :

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

I have 120GB free on a 320 HD, so plenty of room. The trash is empty.

There are all sorts of things I can check and eliminate still... but nothing I know that seems relevant has changed in the last few weeks. I did take it on a trip recently and it went through an airport scanner a couple of times, I can't time travel so can't check this one. I do have a backup from before I travelled, I could start from that and see.

At my flight destination, I had another odd thing happen, my right mouse button would not bring down context menus on click and hold, nor get hover effects on links on browsers. Restart did not help. This particular problem sorted itself after I software updated what was on offer under the Finder menu, used OnyX to do all the maintenance scripts, and executed all the items under Onyx's Automation/cleaning and restarted.

Király replied on :

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

What's in the system.log file at the time you initiate sleep?

David Empson replied on :

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

That's likely to be due to the computer writing all RAM to the file /var/vm/sleepimage before going to sleep. It can then survive losing all power (e.g. due to battery going flat while sleeping) and restore RAM contents when power is restored.

This is generally referred to as "hibernatation mode".

It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models.

This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings.

The only modes which should be used, from the man page:

hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

[end quote]

If you want to change the setting, you need to be logged in as an admin user and use the 'sudo' command to execute the command with root priveleges. It will ask for a password - enter your account password.

Assuming you want to disable hibernation completely:

sudo pmset -a hibernatemode 0

The -a option specifies all power sources.

If you want different modes for when running on power adapter or battery (at the point the computer goes to sleep), you will need to enter the command twice, replacing -a with -b for battery or -c for charger, and replacing 0 with the desired mode.

dorayme replied on :

In article jkjmff$srp$2@redacted.invalid, me@redacted.invalid (Király) wrote:

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

What's in the system.log file at the time you initiate sleep?

Mar 24 14:57:29 QS-2 authexec[2626]: executing /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacO S/uid Mar 24 14:57:34 QS-2 authexec[2653]: executing /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacO S/uid Mar 24 14:57:36 QS-2 authexec[2700]: executing /System/Library/ScriptingAdditions/StandardAdditions.osax/Contents/MacO S/uid Mar 24 14:59:11 QS-2 com.apple.launchd.peruser.503[2344] ([0x0-0xea0ea].com.titanium.OnyX[2463]): Exited: Terminated Mar 24 14:59:37 QS-2 Safari[2400]: Periodic CFURLCache Insert stats (iters: 487) - Tx time:0.005217, # of Inserts: 1, # of bytes written: 19035, Did shrink: NO, Size of cache-file: 53430272, Num of Failures: 0 Mar 24 15:07:42 QS-2 MT-NewsWatcher[2389]: Error loading /Users/dorayme/Library/Contextual Menu Items/AmVisibilityCMX.plugin/Contents/MacOS/AmVisibilityCMX:
dlopen(/Users/dorayme/Library/Contextual Menu Items/AmVisibilityCMX.plugin/Contents/MacOS/AmVisibilityCMX, 262): no suitable image found. Did find:\n /Users/dorayme/Library/Contextual Menu Items/AmVisibilityCMX.plugin/Contents/MacOS/AmVisibilityCMX: mach-o, but wrong architecture Mar 24 15:07:42 QS-2 MT-NewsWatcher[2389]: Cannot find function pointer MyCMMFactory for factory 0B51E4C3-1B30-11D8-8FA3-00039308C192 in CFBundle/CFPlugIn 0x18107de0 </Users/dorayme/Library/Contextual Menu Items/AmVisibilityCMX.plugin> (bundle, not loaded) Mar 24 15:15:55 QS-2 Mail[2410]: Unable to create Spotlight query for expression (((* = "little*"cdw || kMDItemTextContent = "little*"cdw) && (* = "bay""cdw || kMDItemTextContent = "bay""cdw))) && (kMDItemContentType == 'com.apple.mail.emlx' || kMDItemWhereFroms == 'message:*'w) Mar 24 16:00:38 QS-2 loginwindow[2295]: loginwindow SleepWakeCallback WILL sleep Mar 24 16:00:40 QS-2 configd[13]: PMConnection AirPort configd plug-in com.apple.powermanagement.applicationresponse.slowresponse 195 ms Mar 24 16:00:40 QS-2 configd[13]: PMConnection mDNSResponder com.apple.powermanagement.applicationresponse.slowresponse 195 ms Mar 24 16:00:40 QS-2 configd[13]: PMConnection IPConfiguration com.apple.powermanagement.applicationresponse.slowresponse 196 ms Mar 24 16:01:14 QS-2 configd[13]: network configuration changed. Mar 24 17:12:16 QS-2 loginwindow[2295]: loginwindow SleepWakeCallback will power on, Currenttime:3/24/2012 5:12:16.024 PM - Waketime:3/24/2012 5:12:14.920 PM = Deltatime:1.103709042 Mar 24 17:12:18 QS-2 configd[13]: Sleep: Success - AC 99 - Idle Sleep Mar 24 17:12:18 QS-2 configd[13]: Wake: Success - AC 99 - EHC1 Mar 24 17:12:18 QS-2 configd[13]: Hibernate Statistics Mar 24 17:12:18 QS-2 configd[13]: Kernel cupsd com.apple.powermanagement.applicationresponse.timedout 30000 ms Mar 24 17:12:18 QS-2 configd[13]: network configuration changed. Mar 24 17:12:47 QS-2 loginwindow[2295]: no spins reported for this wake

dorayme replied on :

In article 1khh17q.k9htz4m54jycN%dempson@redacted.invalid, dempson@redacted.invalid (David Empson) wrote:

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

That's likely to be due to the computer writing all RAM to the file /var/vm/sleepimage before going to sleep. It can then survive losing all power (e.g. due to battery going flat while sleeping) and restore RAM contents when power is restored.

OK, that sounds very consistent with the facts, it causes no obvious trouble except this delay.

This sounds like there has been some change in my settings then. I have been using it on battery a lot while travelling the last 10 days. The poor dear thought it was a desktop for so long because that is how I used it and it seems to have got confused, or I have done something unusual that has nothing to do with using it on battery a lot or travelling or putting it through airport scanners.

This is generally referred to as "hibernatation mode".

It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models.

This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings.

The only modes which should be used, from the man page:

hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

[end quote]

Last login: Sat Mar 24 14:06:56 on console QS-2:~ dorayme$ pmset -g custom Battery Power: lidwake 1 halfdim 1 sms 1 hibernatefile /var/vm/sleepimage disksleep 10 sleep 10 hibernatemode 3 ttyskeepawake 1 displaysleep 6 acwake 0 lessbright 1 AC Power: halfdim 1 sms 1 hibernatefile /var/vm/sleepimage lidwake 1 disksleep 10 sleep 15 hibernatemode 3 ttyskeepawake 1 displaysleep 5 acwake 0 womp 0 QS-2:~ dorayme$

Seems the AC is set the same as Battery with respect to hibernatemode. Wonder if I can find out, just out of curiosity, if my backup HD (not changed since before this delay happened) will reveal a different set of parameters if I start from it. I better fish it out of its secret hiding place. Will let you know.

If you want to change the setting, you need to be logged in as an admin user and use the 'sudo' command to execute the command with root priveleges. It will ask for a password - enter your account password.

Assuming you want to disable hibernation completely:

sudo pmset -a hibernatemode 0

The -a option specifies all power sources.

If you want different modes for when running on power adapter or battery (at the point the computer goes to sleep), you will need to enter the command twice, replacing -a with -b for battery or -c for charger, and replacing 0 with the desired mode.

If just on battery, this writing to disk sounds sensible, but when AC is connected, it seems not so important and I like no delay. But I can live with delay, its not that important. I was just surprised it was doing it. Perhaps writing to disk in both AC and Battery modes guards against the unlikely event of a power failure and a battery failure?

I am going to try the last suggestion about setting one way for battery (as is) and another for when AC power is charging. I assume that AC Power means the charger is connected.

Most interesting, DE, thanks a lot for this info.

David Empson replied on :

dorayme dorayme@redacted.invalid wrote:

In article 1khh17q.k9htz4m54jycN%dempson@redacted.invalid, dempson@redacted.invalid (David Empson) wrote:

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

That's likely to be due to the computer writing all RAM to the file /var/vm/sleepimage before going to sleep. It can then survive losing all power (e.g. due to battery going flat while sleeping) and restore RAM contents when power is restored.

OK, that sounds very consistent with the facts, it causes no obvious trouble except this delay.

This sounds like there has been some change in my settings then. I have been using it on battery a lot while travelling the last 10 days. The poor dear thought it was a desktop for so long because that is how I used it and it seems to have got confused, or I have done something unusual that has nothing to do with using it on battery a lot or travelling or putting it through airport scanners.

Loss of PRAM may have reset the power management settings to defaults.

This is generally referred to as "hibernatation mode".

It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models.

This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

Look for the "hibernatemode" line under the Battery Power and AC Power headings.

The only modes which should be used, from the man page:

hibernatemode = 0 is the default on supported desktops. The system will not back memory up to persistent storage. The system must wake from the contents of memory; the system will lose context on power loss. This is, historically, plain old sleep.

hibernatemode = 3 is the default on supported portables. The system will store a copy of memory to persistent storage (the disk), and will power memory during sleep. The system will wake from memory, unless a power loss forces it to restore from disk image.

hibernatemode = 25 is only settable via pmset. The system will store a copy of memory to persistent storage (the disk), and will remove power to memory. The system will restore from disk image. If you want "hibernation" - slower sleeps, slower wakes, and better battery life, you should use this setting.

[end quote]

Last login: Sat Mar 24 14:06:56 on console QS-2:~ dorayme$ pmset -g custom Battery Power: lidwake 1 halfdim 1 sms 1 hibernatefile /var/vm/sleepimage disksleep 10 sleep 10 hibernatemode 3 ttyskeepawake 1 displaysleep 6 acwake 0 lessbright 1 AC Power: halfdim 1 sms 1 hibernatefile /var/vm/sleepimage lidwake 1 disksleep 10 sleep 15 hibernatemode 3 ttyskeepawake 1 displaysleep 5 acwake 0 womp 0 QS-2:~ dorayme$

Seems the AC is set the same as Battery with respect to hibernatemode. Wonder if I can find out, just out of curiosity, if my backup HD (not changed since before this delay happened) will reveal a different set of parameters if I start from it. I better fish it out of its secret hiding place. Will let you know.

The power management settings are saved in nonvolatile memory (they are used by the PMU/SMC). Resetting PRAM is likely to revert to defaults. (The hard drive might have a backup copy which it uses to restore the desired PRAM settings.)

If you want to change the setting, you need to be logged in as an admin user and use the 'sudo' command to execute the command with root priveleges. It will ask for a password - enter your account password.

Assuming you want to disable hibernation completely:

sudo pmset -a hibernatemode 0

The -a option specifies all power sources.

If you want different modes for when running on power adapter or battery (at the point the computer goes to sleep), you will need to enter the command twice, replacing -a with -b for battery or -c for charger, and replacing 0 with the desired mode.

If just on battery, this writing to disk sounds sensible, but when AC is connected, it seems not so important and I like no delay.

Depends on what happens after you put it to sleep.

(a) Unplug power in preparation for carrying away, then sleep.

(b) Sleep while power still connected, then unplug power to carry away.

If Battery has hibernatemode = 3, then (a) will be slow to sleep, but will survive loss of power.

If AC Power with hiberanatemode = 3, then (b) will be slow to sleep, but will survive loss of power.

I happen to have different settings. I probably did it by mistake and quite like the combination, so I stuck with it. Mine is set for mode 3 on AC, mode 0 on battery, opposite of what you are suggesting.

If I sleep without the power connected, it happens quickly. This works well if I'm mobile and potentially moving the computer around a few times before I plug it into AC power. I don't want the repeated delay.

If I want to ensure it will hibernate and can survive a power loss, I plug in the power adapter (or leave it connected) before putting the computer to sleep, then I can unplug and carry away.

But I can live with delay, its not that important. I was just surprised it was doing it. Perhaps writing to disk in both AC and Battery modes guards against the unlikely event of a power failure and a battery failure?

See my scenario above.

I am going to try the last suggestion about setting one way for battery (as is) and another for when AC power is charging. I assume that AC Power means the charger is connected.

Yes.

Most interesting, DE, thanks a lot for this info.

You're welcome.

Bob Harris replied on :

In article dorayme-F7A21F.15072424032012@redacted.invalid, dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

I have 120GB free on a 320 HD, so plenty of room. The trash is empty.

There are all sorts of things I can check and eliminate still... but nothing I know that seems relevant has changed in the last few weeks. I did take it on a trip recently and it went through an airport scanner a couple of times, I can't time travel so can't check this one. I do have a backup from before I travelled, I could start from that and see.

At my flight destination, I had another odd thing happen, my right mouse button would not bring down context menus on click and hold, nor get hover effects on links on browsers. Restart did not help. This particular problem sorted itself after I software updated what was on offer under the Finder menu, used OnyX to do all the maintenance scripts, and executed all the items under Onyx's Automation/cleaning and restarted.

SmartSleep http://www.macupdate.com/app/mac/26979/smartsleep can be configured to skip saving RAM to disk if your battery is n percent charged, but if below a user settable percentage, it will save RAM to disk.

This allows for a fast sleep when your battery if mostly charged when putting your laptop to sleep, under the assumption the battery will keep your RAM alive until you can plug your laptop in again.

But if you have been spending house at a coffee shop running the battery down, SmartSleep will save RAM to disk just in case you do not reach a power source before your RAM state is lost because the battery died.

The only down side is forgetting SmartSleep is being used, and you sleep your Mac before going on an extended vacation or business trip without your toys :-)

nospam replied on :

In article 1khh17q.k9htz4m54jycN%dempson@redacted.invalid, David Empson dempson@redacted.invalid wrote:

Assuming you want to disable hibernation completely:

sudo pmset -a hibernatemode 0

The -a option specifies all power sources.

except it doesn't work properly. i have it set to 0, yet there's a sleepimage file that gets written every so often. there is no obvious pattern as to when that happens either. if i delete the sleepimage file, it will come back in a day or two, but otherwise it could go a week or two without being updated.

dorayme replied on :

In article nospam.News.Bob-363290.10515224032012@redacted.invalid, Bob Harris nospam.News.Bob@redacted.invalid wrote:

In article dorayme-F7A21F.15072424032012@redacted.invalid, dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

...

SmartSleep http://www.macupdate.com/app/mac/26979/smartsleep can be configured to skip saving RAM to disk if your battery is n percent charged, but if below a user settable percentage, it will save RAM to disk.

This allows for a fast sleep when your battery if mostly charged when putting your laptop to sleep, under the assumption the battery will keep your RAM alive until you can plug your laptop in again.

But if you have been spending house at a coffee shop running the battery down, SmartSleep will save RAM to disk just in case you do not reach a power source before your RAM state is lost because the battery died.

The only down side is forgetting SmartSleep is being used, and you sleep your Mac before going on an extended vacation or business trip without your toys :-)

Now that I understand what is happening better, thanks to DE, I am finding it is not really bothering me that it takes its time! And now I know how to configure things different ways, my needs are simple, but thanks. btw, I looked at your recommendation software, the comments on the page were not entirely encouraging I think you might agree.

dorayme replied on :

In article 1khh17q.k9htz4m54jycN%dempson@redacted.invalid, dempson@redacted.invalid (David Empson) wrote:

dorayme dorayme@redacted.invalid wrote:

Oddest thing has happened in the last week or so, the command to put my Macbook on Snow Leopard to sleep is suddenly consistently delayed, it used to be almost instant after pressing Option Command Eject or the menu item by mouse under the Apple menu. Anyone come across this? Wondering what it might be due to? The delay can be up to 30 secs.

That's likely to be due to the computer writing all RAM to the file /var/vm/sleepimage before going to sleep. It can then survive losing all power (e.g. due to battery going flat while sleeping) and restore RAM contents when power is restored.

This is generally referred to as "hibernatation mode".

It is controlled by a hidden setting, and is normally enabled for notebook models, disabled for desktop models.

This command in Terminal shows the current power management settings for all power modes:

pmset -g custom

These last couple of days, soon as I press Option Command Eject, it goes to sleep straight away. Like it used to for years.

The setting is exactly the same, '=3' as I mentioned before in reply to your post.

So maybe something else happened that is independent of this setting. Maybe the writing to RAM to disk is still happening but fast and some other reason made it slow and noticeable for a week or two. The Mac is back on my desktop using AC as usual. Anyway, it is not a problem either way but I am a tiny bit curious as to what might have happened.

I have not tested it on battery alone. I keep holding back posting this in case I am doing something unusual and have nothing for the computer to write much to disk about. But it is pretty well consistently sleeping quick on command now without me having changed the setting and I just checked that the setting has not changed form '=3'