27

A (Windows 7) laptop has been annoying me since the day we got it. When it is put to sleep (the lid closed), it seems to intermittently wake up randomly during the night (i.e., 10pm, 1:30am, 7am, etc.) There are plenty of people experiencing this, but I have done several tests and made numerous observations to provide as much information here as possible to diagnose the problem.


When the laptop wakes up in the middle of the night, several telling observations can be made:

  • It stays on for approximately 20-50 seconds (more than a few, less than a lot)
  • The screen remains off (completely, not just the back-light)
  • The hard-drive is thrashed the whole time (HD LED is nearly solid)
  • The DVD drive spins up and whirs loudly for ~5-10 seconds if there is a disc in it
  • Windows is active (the PnP bing-bong noise is played if a drive/keyboard/etc. was removed or plugged in after the system was put to sleep)
  • (Unconfirmed: pressing a key—if enabled—won’t turn it on next time; must use the power-button)
  • The next time the system is turned on, there is no indication of the previous, random activity (using powercfg -lastwake returns a Wake History and Wake Source Count of 0)

Other observations include:

  • Does not seem to happen when Windows is shut down or hibernated, only when put to sleep (e.g., lid closed)
  • There are countless tasks in the Task Scheduler in Windows 7, but a quick scan seems to indicate that none are responsible (though I have enabled the history to keep track)
  • (I keep trying to catch it to press a key to get the screen to show to see what is happening, but it always seems to happen at an inopportune moment and shuts down before I get the chance)
  • As Mark suggested, I checked the Event Log and found a set of events that are the best clue yet:

    6:51:37pm The system is entering sleep.
              Sleep Reason: Button or Lid
    6:51:42am The system time has changed to ‎2012‎-‎08‎-‎21T10:51:42.500000000Z from ‎2012‎-‎08‎-‎20T22:51:39.080510600Z.
    6:51:42am-6:51:47am Six services were stopped…
    6:51:47am The system has resumed from sleep.
              Sleep Time: ‎2012‎-‎08‎-‎21T10:51:46.021150600Z
              Wake Time: ‎2012‎-‎08‎-‎21T10:51:44.010053500Z
              Wake Source: S4 Doze to Hibernate
    6:51:55am The system is entering sleep.
              Sleep Reason: Hibernate from Sleep
    

What it’s not:

  • Windows update : WU is set to only check, not download and do so at noon (not randomly)
  • Wake-on-LAN : WoL and Magic-Packet are both disabled in Device Manager, there is no option in the BIOS, and cable-modem is turned off at night
  • Devices : All keyboards, mice, NICs are set to not wake the system (powercfg -devicequery wake_armed returns an empty list)
  • Malware : This is a new system with up-to-date Windows updates and active MSSE with the latest defs, plus careful browsing with the latest Chrome and no files that are even the least bit questionable

I have two theories as to what it could be:

  1. Hybrid sleep

    In Windows Vista and up, hybrid sleep lets the system first sleep (suspend to RAM), then after some time, flush the memory to disk to hibernate. This may make sense in that the laptop is sleeping, and then eventually switches to hibernation, so it wakes up to flush the memory to disk.

    This could work since instead of going straight into Windwos, the BIOS POSTs and Windows “Resumes”. However, it should transition from sleep to hibernation at the same time, not randomly. Moreover, this particular laptop does not have hybrid sleep enabled.

    Can anyone confirm how (at a low level) if hybrid sleep works like this?

  2. Low battery

    When a laptop’s battery is too low, Windows automatically hibernates (of course Windows does this before the battery is too low so that it has enough power left to perform the hibernation). When it does this, the hard-drive thrashes for a few dozen seconds and then shuts down. This seems to match the behavior of the laptop when it wakes up randomly, especially since the battery can reach the drained-point at a seemingly random time.

    The problem with this theory is that when the system is turned on after having awaken randomly, it does not print the message about Windows having shut down due to a low battery like it does whenever it hibernates due to a low battery while it is running.

    Further, it implies that Windows is active and processing (to some extent) while it is sleeping or even when it should already be off/hibernating.

    Can anyone confirm if Windows is active and monitoring battery levels while “off”?


Based on the events, it looks like updating the system time is normal whenever the system turns on, so it’s not that, but it is clearly transitioning from sleep to hibernation at twelve hours after it went to sleep. This is baffling for three reasons:

  • The current setting is to hibernate after three hours on battery and six hours when plugged in for the Balanced and Power Saver plans (four hours and not at all with the High Performance plan). The Power Saver plan is in effect and it was unplugged this morning when it happened
  • Hybrid-sleep is disabled in every power plan
  • powercfg has no record of it happening

Does anyone know why Windows would wake up randomly and exhibit the above symptoms or why the power plan settings seem to be incorrect?


There are a lot of people experiencing laptops (of all makes and models) randomly turning on in the middle of the night. Unfortunately most of them get the same set of responses which rarely seem to fix the issue.

Some notable ones include:

  • This question that seems to be the same issue with a couple of the observations I have made above.
  • This question seems to have the same issue, but with Linux.
  • This question lead me to turn off the keyboards/mice in case the touchpad sensitivity is set too low, but it still does it.
  • This thread points at sleep-timers, but they are already disabled.
13
  • 4
    +1 Just because I love this question, the thoroughness, the work behind it. This is a thing of beauty. Never mind the answer, I just want to enjoy the question some more... ;)
    – Everett
    Commented Aug 21, 2012 at 21:17
  • I think one of your first sentences is also your solution: "When it is put to sleep (the lid closed)". Are you sure that 'closing the lid' == 'hibernating'? If I remember correctly, the default setting for closing the lid is standby, and not hibernate. Go to configuration screen -> hardware and sound -> energymanagement -> Change when the screen is disabled (left panel) -> advanced settings -> change the settings under 'standby' (or sleep or sth.) and 'on/off buttons and lid'. (I use a Dutch windows 7 and tried to translate as good as possible, but things might be called different.)
    – BrtH
    Commented Aug 21, 2012 at 21:18
  • @BrtH, yes, it is set to sleep by default, but that does not explain why it would suddenly, randomly, spontaneously turn on again. I have looked for hardware and software triggers that could cause it to turn on, but none seem to apply. Plus, I already said it doesn’t seem to happen when using the actual Shutdown or Hibernate commands.
    – Synetech
    Commented Aug 21, 2012 at 21:20
  • 1
    I wonder if Microsoft didn't use a shortcut in going from Sleep to Hibernate. Your computer is Sleeping. It is not in use, and the battery level drops. The computer protects itself by going to Hibernate. You don't get notification. What if Microsoft used the same code that Hybrid sleep uses when the computer is already asleep (did it as a shortcut)? You're not using the system, so who cares that the reason it went Hibernate on you is that the power dropped (just like the Hybrid system wouldn't care). I'm done, I just wanted to try to say something intelligent.
    – Everett
    Commented Aug 21, 2012 at 21:21
  • 1
    What does the Windows System Event log say? It seems like there should be something in there when it sleeps or hibernates.
    – Mark Allen
    Commented Aug 21, 2012 at 23:24

3 Answers 3

17

At the risk of looking stupid, I found the following:

I also had the same problem. I never shut down my laptop, I always put it into sleep mode, and it would wake up unexpectedly in the middle of the night. I discovered that this "S4 Doze to Hibernate" event is not a bug, it's a feature. Go to power advanced settings and change "hibernate after" under "sleep" drop down menu:

enter image description here>

Choose how long you want to wait before going to hibernate from sleep mode. I set mine to 1440 minutes (24 hours) which is enough for staying overnight.

By the way, also check you don't have anything under "allow wake timers".

I don't see that you say you've tried this, so if I missed you pointing it out, I apologize for wasting your time.

8
  • If it had awakened transitioned after two hours like it is set to, then I could accept that as the explanation, but it did so after twelve, so if it is the reason, then I don’t know why it is using the wrong time.
    – Synetech
    Commented Aug 22, 2012 at 2:37
  • "6:51:42am The system time has changed to ‎2012‎-‎08‎-‎21T10:51:42.500000000Z from ‎2012‎-‎08‎-‎20T22:51:39.080510600Z." -->Because the clock is 12 hours off?
    – Everett
    Commented Aug 22, 2012 at 2:45
  • 1
    No, that’s not updating the system time from an Internet time-server, it is simply noting that twelve hours have passed.
    – Synetech
    Commented Aug 22, 2012 at 3:41
  • Solar flares? I kid. I'll stop here, I feel I legitimately tried.
    – Everett
    Commented Aug 22, 2012 at 3:42
  • I finally did a good test. I set hibernation to 60 mins, closed the lid at 19:00:00, and opened it at 19:59:50. Ten seconds later, the laptop turned on and did it's usual thing. This time however, the lid was open so I was able to see the Windows login screen for a second before the screen turned off. I pressed the DVD eject button and it opened. I moved the cursor and pressed the touch-pad buttons but nothing happened. I pressed some keys to try to log in, but only got the Windows default beep. The next time it was on, I checked the Event Log and yup, it logged a state change from S3 to S4.
    – Synetech
    Commented Sep 8, 2012 at 20:00
5

SleepWakeSolution

This is a solution for those who want their computers to never wake from sleep on their own anymore and simpler solutions have not worked. Nothing other than tapping a button or opening the cover will wake it. Not the planned tasks which are scheduled to wake up your system such as Windows Media Center or the unknown causes. The only negative I’ve found is that a laptop will not wake to hibernate if the battery is getting too low. It will just go dead and any unsaved information will be lost.

Open a command-prompt and run the following commands:

powercfg -setacvalueindex scheme_current sub_sleep bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
powercfg -setdcvalueindex scheme_current sub_sleep bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 0
powercfg -setactive scheme_current

These can be copied and pasted into the command prompt by clicking on the header/edit/paste at the top of the command prompt window.

This changes the default values for the current power scheme and stops the machine from being woken from sleep.

Applies to following registry keys:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\BD3B718A-0680-4D9D-8AB2-E1D2B4AC806D
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\238c9fa8-0aad-41ed-83f4-97be242c8f20\bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\BD3B718A-0680-4D9D-8AB2-E1D2B4AC806D
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\238c9fa8-0aad-41ed-83f4-97be242c8f20\bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\238C9FA8-0AAD-41ED-83F4-97BE242C8F20\BD3B718A-0680-4D9D-8AB2-E1D2B4AC806D
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\User\PowerSchemes\381b4222-f694-41f0-9685-ff5bb260df2e\238c9fa8-0aad-41ed-83f4-97be242c8f20\bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d

The above has been tested to work in Win7 and Win8. It modified the SKUACSettingIndex to a 0 from a 1 in Win8 under all the above categories during the test, which could also be done manually through regedit as an alternative. This enables a power scheme with the ability to wake from sleep completely disabled. Again, the only negative I have found is that a laptop will not wake to hibernate if the battery is getting too low. It will just go dead.

Important: The additional step of going to Control Panel / Power Options, and then resetting the current power scheme to the default values under advanced settings may also be necessary after implementing the config changes. The user can then readjust things back to their own preferences.

During my command-prompt test on a new Win8 system, it appears to have reset the power settings to default since things again have their default time-out settings after using the command-prompt solution. There have also not been any wakes reported during the test period in Event Viewer /system.

I also reviewed the Event Viewer on two other systems, and there have not been any wakes on those systems since I implemented the Command Prompt solution on them two weeks ago.

To return the defaults to the original values, enter the same command-prompt lines but enter a 1 for the last character instead of a 0. Then change the current power scheme back to default values in Power Options.

HKEY_USERS\S-1-5-19\Control Panel\PowerCfg - This lists the current Power Policy.
4
  • Completely disabling automatic power-on is a bit scorched-earth, but I suppose it could be useful for some systems that just won’t behave.
    – Synetech
    Commented Feb 8, 2013 at 17:53
  • I've found that it's a necessity in Las Vegas to protect high-end laptops from turning themselves on during 100 degree plus days while the laptop is in it's case in a parked car. I've had warped keyboards, fried video cards and thermal shutdown faults that caused all sorts of grief and expense. It also avoids any unnecessary battery drain. Some laptops go back to sleep after a short time, while others can remain on until the battery goes dead or a thermal shutdown takes place if the sleep timer is set for a longer period. Commented Feb 8, 2013 at 19:04
  • I’d say that in that case, it would be better to figure out the cause of the wake in the first place instead of just preventing it from happening. Systems should not be turning on for no reason, and certainly not staying on for no reason. It would be better to check WoL, hybrid-sleep, and device-wake options, and then block it if nothing else works (e.g., if the system is buggy).
    – Synetech
    Commented Feb 8, 2013 at 21:09
  • 1
    Though my comment is a bit late... From my own experience it is often very nearly impossible to find all possible causes, and at least it is impossible to know if those found were all. Also, at any time a new cause (e.g. scheduled task) may be added by software. Considering that a laptop turning on in a bag may very well destroy the laptop (or worst-case even ignite a fire), fully disabling automatic wake seems pretty reasonable. It is one of those behaviours no operating system currently seems to get right.
    – kdb
    Commented Nov 29, 2014 at 11:28
0

On Win7 Pro, instead of fiddling with registery setings directly, you can use Group Policy Editor gpedit.msc > Computer Configuration > Administrative Templates > System > Power Management > Sleep Settings tweak it to your taste, reboot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .