My Windows system refuses to sleep or hibernate. What could be wrong?
A Windows computer that won't sleep, hibernate or shut down correctly is typically experiencing a problem with Windows power management.
Power management problems can be tough to track down since they spring from how various system components (including the operating system) depend on each other. A single device that doesn't support sleep modes, a buggy BIOS or a badly written program could be the culprit. And sometimes there's not one culprit but a whole collection of elements interfering with sleep.
Symptom 1: The system fails to sleep at all.
The most common symptom is a system that attempts to go into sleep mode, but then immediately wakes up for no apparent reason. (Or it may simply fail to sleep at all -- or the sleep option just isn't present in the shut down menu.)
In this case, the first step is to diagnose the components of the computer -- including the PC itself, its BIOS and power-management subsystems -- that might be blocking sleep mode.
Windows Vista and Windows 7 have several tools that allow detailed debugging, the most powerful and significant being powercfg command-line utility. Running powercfg from a command prompt -- preferably one where you have admin privileges -- will give you details about what happens when your system tries to sleep.
The first command you'll want to run is powercfg -a, which dumps out a list of sleep states available to the system. If some of the sleep states are not available, powercfg will attempt to report why they can't be used. Sometimes the system's BIOS needs to be updated to support those modes; other times the BIOS supports sleep states, but its current settings have disabled those functions. Note that if, for example, the system supports S1 and S3 but not S2, this generally isn't a problem. Many systems don't support S2 but can still sleep and hibernate without issues.
More advice from our Windows expert
What to look for when switching from 32-bit to 64-bit Windows
Assigning the right drive letter for a USB drive
Steps for solving the reboot loop problem
In addition, there may be a given device that is preventing the system from entering sleep mode. Sometimes the system alerts you of this and names the device if the system fails to sleep. The device in question often sports an out-of-date driver, and a simple update may solve the problem. Sometimes the problem is a cross-interaction between other software, although these can be difficult to debug without feedback from other users.
One way to garner data about what might be keeping the system from sleeping is powercfg -requests, which lists all the current system requests being made by various programs that could prevent the computer from sleeping. For example, I had music playing when I ran that command, which produced a list of requests including a reference to my "USB audio device" with the notation "An audio stream is currently in use." Many of these requests can be overridden by the system if the program making them has been written to honor sleep mode correctly. So if something shows up on this list, that doesn't make it a surefire culprit -- it's just something to investigate further.
Symptom 2: The system wakes up for no apparent reason.
This one is almost as frustrating: The system does sleep, but it wakes up either almost immediately or at random times. A good way to tease this out is with the powercfg -lastwake command, which names the last device to wake the system.
If you run powercfg -devicequery wake_armed, you can obtain a list of the devices that are "armed" to allow the system to be awakened. Most of the time, the list will look like this:
Microsoft USB IntelliMouse Optical (001)
HID Keyboard Device (006)
HID-compliant mouse (004)
HID Keyboard Device (012)
If you see something that you don't want to wake the system -- like a network connection -- you can disarm it with the command powercfg -devicedisablewake
powercfg -devicedisablewake "Intel(R) 82566DC-2 Gigabit Network Connection (002)"
The quotes allow powercfg to properly understand the full name of the device. Any number in parentheses after the device name should also be included.
I mention the network device here as a specific example because one of the most common culprits for this problem is "wake on LAN," a feature where a computer can be roused out of sleep mode by a certain network signal. Sometimes it works a little too well, and the computer wakes up when it receives almost any random network traffic.
Furthermore, the system could be waking up randomly because it has been timed to do so by a scheduled task. Again, powercfg comes to the rescue: Use powercfg -waketimers to see if the system is scheduled to wake up at any particular time by a given task. You can disarm the items through the Task Scheduler, but note that some of those tasks may have been set up for a reason like system or administrative maintenance.
For further details, powercfg -energy can be run to generate a detailed report in the form of an HTML file (energy-report.html) in the current directory. The "Errors" and "Warnings" sections contain details about devices that may be preventing sleep mode. Make sure to close all programs before running this commend so you don't receive false warnings.
Symptom 3: The system sleeps, but does not hibernate.
The most common reason a system can't hibernate is because the hibernation file -- the file on disk where the contents of memory are written when the system hibernates -- has been deleted or hibernation has been explicitly disabled. It can be turned it back on with powercfg -h on. This command should also provide feedback if hibernation can't be re-enabled.
Windows can also fail to hibernate if the system was set up to dual or multiboot with another operating system. Since Windows tends to be finicky about being the primary OS installed on a computer, it will not hibernate if it detects that the partition marked for startup on the first hard disk is not itself a bootable Windows drive.
Side note: Hibernation is not always available as an option in the Windows 7 shutdown menu. This is partly because by default Windows 7 sets up "hybrid sleep" in which the system is suspended but a hibernation file is also written out to disk as a backup in case of a power failure. The system stays in this mode for the length of time dictated by the power plan, found in Advanced Settings under Sleep | Hibernate after.
While this isn't as problematic for a desktop, many notebook users find it annoying. To disable hybrid sleep entirely -- and make hibernate an explicit option in the shutdown menu -- edit the power plan's advanced options and set Sleep | Allow hybrid sleep to Off. Another option is to have the computer's power button enable hibernation while closing the lid or selecting Sleep from the power menu. You can set this behavior from the Power buttons and lid options in the power plan's advanced options.
Symptom 4: The system crashes on resume.
If a system crashes on resume for no apparent reason, the hibernation file itself may be corrupt. I once had this happen when a disk error damaged the hibernation file. When I deleted and recreated the hibernation file, the issue was resolved. The Powercfg command can do this through a variant of the tip mentioned in Symptom 3: First run powercfg -h off to turn hibernation off, and then run powercfg -h on to restore it.
If that doesn't work, you're likely dealing with a flaky device driver. Use a tool like BlueScreenView to retrieve information about the crash, and see if there's an updated version of the offending device driver. Check if a hotfix is available or make sure you have the most recent service pack for the operating system. If everything checks out, it may simply be buggy and might have to be disabled entirely for the system to work.
ABOUT THE AUTHOR
Serdar Yegulalp is editor of the "Windows Power Users Newsletter." Check it out for the latest advice and musings on the world of Windows network administrators..